in reply to Re^6: Memory management
in thread Memory management
One of the reasons to "hold onto memory" once you get it is that the OS memory allocator is "expensive" in terms of CPU. Often when making a memory region allocated to you either bigger or smaller, the OS will get another contiguous hunk of the right "new size" and then copy all the old stuff into the new area! All this copying around can get really expensive! Perl has to do extra work to keep track of memory management, but at the end of the day this works out to be very much more performance efficient. I've run some tests in C with gcc on my WinXP platform to just to experiment with this although I don't think it appropriate to post C code here. But Perl is written in C and will be making all the same malloc(),calloc(),realloc() type memory calls.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Memory management
by desemondo (Hermit) on Aug 20, 2009 at 10:04 UTC |