In my simple tests, the SV is being reused, but that isn't the space I am concerned about being reused. The hope ws that the PVAV used by the array and the PV used by the bitvector would reuse the same space, but that isn't the case here.

use Devel::Peek;; my @a = 1 .. 87382; Dump \@a; <STDIN>; undef @a; <STDIN>; my $b = 'x'x2**20; Dump \$b; <STDIN>; SV = RV(0x183573c) at 0x1cd99fc REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x195d6d0 SV = PVAV(0x195cb7c) at 0x195d6d0 REFCNT = 2 FLAGS = (PADBUSY,PADMY) IV = 0 NV = 0 ARRAY = 0x1d2fbbc FILL = 87381 MAX = 87381 ARYLEN = 0x0 FLAGS = (REAL) Elt No. 0 SV = IV(0x194246c) at 0x195d82c REFCNT = 1 FLAGS = (IOK,pIOK) IV = 1 Elt No. 1 SV = IV(0x1942468) at 0x195d814 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 2 Elt No. 2 SV = IV(0x1942470) at 0x1824704 REFCNT = 1 FLAGS = (IOK,pIOK) IV = 3 Elt No. 3 SV = IV(0x1942474) at 0x195d7fc REFCNT = 1 FLAGS = (IOK,pIOK) IV = 4 SV = RV(0x183573c) at 0x195d82c REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x1cd999c SV = PV(0x225584) at 0x1cd999c REFCNT = 2 FLAGS = (PADBUSY,PADMY,POK,pPOK) PV = 0x203002c "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx... CUR = 1048576 LEN = 1048577

There is also the problem that when the function is called, there would be no way to know what amount of reusable memory is alredy available in the system.

On win32 I can query the VM size directly from the OS and form my upper bound from that, but I have no idea how to make that cross system compatible. Perl almost certainly has a good idea of where the end of it's memory is. I just don't have any clues how I could tap into that information?


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.

In reply to Re^6: Circular reference testing. by BrowserUk
in thread Circular reference testing. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.