in reply to Running out of Memory

It's as if the arrays aren't getting garbage collected, but I've examined the reference count just prior to the reference leaving scope and it only has one reference (using Devel::Peek Dump).

Oh look, a reference count of 1 :)

my @one; my @two; my @three; push @two, \@three; push @three,\@two; push @one, \@two, \@three; use Devel::Peek; Dump(\@one ); __END__ SV = RV(0x3e8a90) at 0x3e8a84 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x98a404 SV = PVAV(0x3e995c) at 0x98a404 REFCNT = 2 FLAGS = (PADMY) ARRAY = 0x997dec FILL = 1 MAX = 3 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = RV(0x98a4b0) at 0x98a4a4 REFCNT = 1 FLAGS = (ROK) RV = 0x98a424 SV = PVAV(0x3e9b84) at 0x98a424 REFCNT = 3 FLAGS = (PADMY) ARRAY = 0x9b1d7c FILL = 0 MAX = 3 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = RV(0x3e8b30) at 0x3e8b24 REFCNT = 1 FLAGS = (ROK) RV = 0x98a444 Elt No. 1 SV = RV(0x3e8970) at 0x3e8964 REFCNT = 1 FLAGS = (ROK) RV = 0x98a444 SV = PVAV(0x3e9b9c) at 0x98a444 REFCNT = 3 FLAGS = (PADMY) ARRAY = 0x994b2c FILL = 0 MAX = 3 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = RV(0x3e8b80) at 0x3e8b74 REFCNT = 1 FLAGS = (ROK) RV = 0x98a424

Replies are listed 'Best First'.
Re^2: Running out of Memory
by nwboy74 (Novice) on Oct 07, 2010 at 22:16 UTC
    If you look at SV = PVAV(0x3e995c) at 0x98a404, which is the array reference, it has two.
      :) If you look at ... in your original post, it could be hiding an elephant :)