[MTOS-dev] Memory Utilization Brainstorm

Alvar Freude alvar at a-blast.org
Fri Dec 28 14:58:56 PST 2007


Hi,

-- Hirotaka Ogawa <hirotaka.ogawa at gmail.com> wrote:

> Don't expect too much of my previous post!  It is effective in the
> simple benchmark case, but much further investigations are still
> required for general solutions.

:)


>> hmm, but then every piece of code which uses MT::Template must be
>> checked. It would be better, when MT::Template does this by itself by
>> adding a DESTROY method, which should make the big cleanup. [1]
>
> I think it's impossible. Mutually referenced objects will never be out
> of scope as far as the Perl process lives (is it wrong?).  On the
> contrary, DESTROY method is useful for finding objects not being
> properly released.

As far as I understand your example, the object gets destroyed. But some 
variables in the internal state of the object may be not properly 
destroyed.

So, since $tmpl is not referenced insite itself, it gets destoyed after 
the loop.

I can't check at the moment with the example fast (OS X has no /proc ;-) 
), but you may test it with such a sub DESTROY:


sub DESTROY
   {
   # force to free
   for my $token (@{$tmpl->tokens})
      {
      $token->[5] = $token->[6] = undef;
      }

   $tmpl->reset_tokens;
   $tmpl->context(undef);
   }


> Yes.  We must study the inside of MT much further by employing these
> tools.

there are also some other related Modules on CPAN, but I don't know by 
rote ;-)


Ciao
  Alvar

-- 
** Alvar C.H. Freude, http://alvar.a-blast.org/
** http://www.assoziations-blaster.de/
** http://www.wen-waehlen.de/
** http://odem.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://www.sixapart.com/pipermail/mtos-dev/attachments/20071228/2ba0e636/attachment.bin 


More information about the MTOS-dev mailing list