Code segment unload: Difference between revisions

Added verbiage about Perl
(Added verbiage about Perl)
Line 65:
 
This is simpler in gp -- just <code>kill</code> the function (or set it to 0, not quite the same but will also cause the memory to be collected).
 
=={{header|Perl}}==
Perl uses reference counting as its method of managing memory use. As soon as the last reference to a value is released, the value may be destroyed and freed, and handed back to the memory pool. However the exact timing of this action is not under programmer control.
Within your program, by using <code>undef</code> and <code>delete</code>, you can <i>hint</i> to Perl that it would now be OK to release this memory. Most importantly, such actions should not be confused with releasing memory back to the operating system. In cases where it is necessary to temporarily allocate a large amount of memory, do so via <code>fork</code>, so when the child process exits the memory is truly freed back to the system.
 
=={{header|Perl 6}}==
2,392

edits