[MLton-devel] Minimizing space usage in ML (fwd)

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Tue, 22 Oct 2002 15:28:44 -0400 (EDT)


> > The idea that Henry mentioned:
> > is practical and eliminates all duplicates in an object or even the
> > entire heap by combining copying GC with hash consing.
> 
> I'm extremely pleased to hear that there is a practical scheme to do
> this on your to-do list, but I'm afraid I'm not a compiler hacker,
> just a user who repeatedly constructs lots (sometimes gigabytes) of
> immutable similar objects :-(

Note: you can generally implement hash-consing yourself, especially if
your data is AST-like (as opposed to, say, integer lists).  

There still isn't as much compiler support there as one might hope.  If
you don't periodically empty the hash-table, you can still end up
retaining a significant number of objects that are only reachable through
the hash-table.  Weak pointers would help in this context.  The hash-table
can still contain a lot of entries if you don't clear out the NULLed
pointers, but presumably those pointers are much smaller than the object
they were pointing at.  (And, I think, one could fairly easily amortize
the cost of clearing NULLed pointers across insert and lookup functions.) 



-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ad.doubleclick.net/clk;4699841;7576301;v?http://www.sun.com/javavote
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel