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

Sorry diotalevi, I'm sure you know what your getting at, but it's going right over my head.

I don't see how Lexical::Alias has anything to do with what Japhy and I were discussing, and as Japhy wrote Lexical::Alias I would have thought that he would have recognised the correspondance if there was one.

The last thing I need for my purposes is the creation of yet more perl internal structures and hash entries (pad entries) pointing to things that I don't have a first name for and couldn't use a second name for, even if they didn't involve using more space--which is exactly what I'm trying to avoid.


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.

Replies are listed 'Best First'.
Re^15: Techniques On Saving Memory
by diotalevi (Canon) on Mar 20, 2005 at 22:34 UTC

    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.

      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?