Can you advise me how to use weaken in my example?
I Tried to add weaken($t) after calling $t->dispose() but nothing changed, memory use remained the same. I also tried to call weaken($t) after $t= new XML::Twig but that simply made the XML::Twig object break, it failed on the next method call.