in reply to Memory Management...
Does Perl like/dislike explicit memory management by setting the above $gxmlDocument and $gxmlObject = undef?Perl has no feelings, so it couldn't care less. However, you are wasting resources this way. $gxmlDocument and $gxmlObject are about to go out of scope, after which Perl will free the memory they use, which will most likely cascade in the freeing of the memory they point too. But before that, you first create two new SVs (both undef), each taking at least 12 bytes, more on 64 bit platforms. After that, the objects go out of scope cleaning up the newly created SVs.
The end result is the same. Both letting Perl handle the memory, and you doing the undef will arrive at the foot of the hill. But with your method, you first go uphill.
If you want to take the long road, use your undefs. If you want to be efficient, let Perl do the job.
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Memory Management...
by scottj (Monk) on Feb 04, 2004 at 05:31 UTC |