Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: inside-out objects using arrays?

by chromatic (Archbishop)
on Sep 18, 2005 at 02:20 UTC ( #492965=note: print w/ replies, xml ) Need Help??


in reply to Re^4: inside-out objects using arrays?
in thread inside-out objects using arrays?

If you really want to save memory, you may want to avoid pinning your inside-out array at the high-water mark. Store a stack of reclaimed indices and push to it in the destructor and shift from it when generating the reference for a new object. Then you can shrink the array if necessary.

(When you ask "Wait, won't it stay at the high-water mark even if there were 1000 elements and are only two now?", I'll sigh and talk about compacting garbage collectors and double-indirection the other flaws in this scheme. Still, it's a fun idea.)


Comment on Re^5: inside-out objects using arrays?
Re^6: inside-out objects using arrays?
by rvosa (Curate) on Sep 18, 2005 at 12:23 UTC
    Hey, that's neat. I'll have to think about that. Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://492965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (17)
As of 2015-07-01 20:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls