in reply to Re^14: Techniques On Saving Memory
in thread Techniques On Saving Memory

Now I recall what I was looking for: Array::RefElem. Here is the same operation which uses an array's internal pointer array to good use vs using a string as a perl-artificial pointer array.

av_store( @foo, 1, $bar ); $baz = \ $foo[ 1 ]; $baz == \ $bar; VS 4 == length( pack( 'N', 0 ) ); substr( $foo, 4 * 1, 4, pack( 'N', 0 + \ $bar ); # Increment the refcount of $bar somehow. $baz = \ Devel::Pointer::unsmash_sv( unpack( 'N', substr( $foo, 4 * 1, + 4 ) ) ); $baz == \ $bar;

UpdateD: Previously, I mispelled Array::RefElem as Array::RefElement and the search.cpan.org link wouldn't work.

Replies are listed 'Best First'.
Re^16: Techniques On Saving Memory
by BrowserUk (Patriarch) on Mar 21, 2005 at 01:23 UTC

    Thanks diotalevi, That module (actually called Array::RefElem), does appear to do exactly what I was suggesting. I'll need to pour over Perlguts Illustrated some more to convince myself completely.

    I think wrapping it in a tied array will achieve exactly what I been trying for two years to get! In my defense, the name does not exactly leap off the page at me, and even the description is somewhat terse. You'd need to be fairly ohfay with XS/internals to understand it.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco.
    Rule 1 has a caveat! -- Who broke the cabal?