Memory allocation: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) (Added Perl verbiage) |
|||
Line 951: | Line 951: | ||
c1.destroy; |
c1.destroy; |
||
end;</lang> |
end;</lang> |
||
=={{header|Perl}}== |
|||
In general, memory allocation and de-allocation isn't something you can or should be worrying about much in Perl. |
|||
Perl manages its own heap quite well, and it is exceedingly rare that anything goes wrong. As long as the OS has memory to give, |
|||
a perl process can use as much as it needs. |
|||
Memory allocated to lexicals, i.e. <tt>my()</tt>, variables cannot be reclaimed or reused even if they go out of scope |
|||
(it is reserved in case the variables come back into scope). You can 'hint' that memory allocated to global variables |
|||
can be reused (within your program) by using <tt>undef</tt> and <tt>delete</tt>, but you really have little control over |
|||
when/if that happens. |
|||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |