Re: Image::Magick memory leak question

From: William Herrera (posting.account_at_lynxview.com)
Date: 11/20/03


Date: Thu, 20 Nov 2003 05:27:33 GMT

On Wed, 19 Nov 2003 19:57:31 +0000 (UTC), Stan Brown <stanb@panix.com> wrote:
>
>BTW, adding @$image = ();, right before the undef $image; call seems to
>have drasticly lowered the ammount of memory that it's leaking.
>
>Does that make any sens at all? I would hhave thoughtthat the undef would
>have deleted all parts of the $image object. Am I wrong?
>

With some module objects, who knows? You are undefining a reference to the
object, which cetainly frees the object (the array) if there are no other
references to it. However, it may be that the object's code keeps some hidden
reference to instances of itself (circular?) which then preserves all the
elements in the array when you undefine it. When you instead set the array
contents to none, you dereference and destroy all the actual elements in the
array. So the amount of leak is limited to just the empty array object's memory
usage alone, probably a much smaller leak.. I hope this makes sense. In any
case, I suggest considering saving required states, exiting, and re-running
the script itself periodically, to keep any remaining leakiness under control.

---
Use the domain skylightview (dot) com for the reply address instead.


Relevant Pages

  • Re: How to give selective access to the methods in a class?
    ... different memory locations at different times. ... The reference still leads to the ... So array resizing ... program pushes certain objects into the circular buffer, ...
    (comp.lang.java.programmer)
  • Re: High Memory Consumption of Classes and Arrays
    ... > that classes and arrays in dotnet consume very much memory. ... you consider the reference as well). ... a reference to an array which contains the actual items. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Image::Magick memory leak question
    ... >>have drasticly lowered the ammount of memory that it's leaking. ... >>have deleted all parts of the $image object. ... >elements in the array when you undefine it. ... So the amount of leak is limited to just the empty array object's memory ...
    (comp.lang.perl.misc)
  • Re: pinning types via Fixed
    ... > Now, for correctness, shouldn't he be locking the reference to the ... The array cannot be garbage collected since there is still a refererence on ... But it might be moved in memory when not beeing fixed so it is IMHO ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Garbage Collection Issues in long-standing services
    ... The problem with sockets is the unmanaged memory buffers used by the ... (probably a byte array) ... The result is that, depending of the number of buffers, ... > reference between CS and AP, so I don't explicitly set each reference to ...
    (microsoft.public.dotnet.languages.csharp)