in reply to Re^3: Freeing memory, revisited (Linux)
in thread Freeing memory, revisited (Linux)
Simply the truth.
So if constant folding (+ allocation) and storing the results as part of the code happens at compile time, how would you explain that the (runtime-)prints in the strace output of the following snippet are interleaved with the allocations?
{print STDERR "1"; "x" x 2**20} {print STDERR "2"; "x" x 2**20} {print STDERR "3"; "x" x 2**20}
$ strace -e mmap,munmap,write ./903114.pl ... write(2, "1", 11) = 1 mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, - +1, 0) = 0x7fe6d7315000 write(2, "2", 12) = 1 mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, - +1, 0) = 0x7fe6d5e0f000 write(2, "3", 13) = 1 mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, - +1, 0) = 0x7fe6d5d0e000 munmap(0x7fe6d5d0e000, 1052672) = 0 munmap(0x7fe6d5e0f000, 1052672) = 0 munmap(0x7fe6d7315000, 1052672) = 0
Also,
$ perl -MO=Concise,-exec ./903114.pl ... 11 <$> const[PV "x"] s 12 <$> const[IV 1048576] s 13 <2> repeat[t9] vK/2 <--- ...
seems to suggest that the repetition operator is applied at runtime.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Freeing memory, revisited (Linux)
by dave_the_m (Monsignor) on May 05, 2011 at 16:44 UTC |