On Fri, 5 Sep 2003, Peter Haworth wrote: > On Thu, 4 Sep 2003 09:02:18 -0400 (EDT), Dan Sugalski wrote: > > On Wed, 3 Sep 2003, Gordon Henriksen wrote: > > > A seen hash is also threadsafe, can be interrupted by DoD, and is safe > > > for recursion. (By "threadsafe," I mean that unchanged data structures > > > can be safely serialized from multiple threads without ill effect or > > > possibility of deadlock.) > > > > While a seen hash is DOD-interruptable (which, admittedly, the scheme I'm > > preferring isn't, or is with a *lot* of care) it's also slower and > > requires a lot more resources when running. > > If you're freezing a large graph of PMCs, that's going to take up a lot of > memory, however you do it (other than streaming to disk). What happens when > you run out, and need to garbage collect? With your scheme, this is a big > problem, since as you say, it's either not possible or needs a lot of care.
Note that using the pointers in the PMCs means *DOD* must be disabled, not *GC*. Doing a GC run to reclaim memory is perfectly fine, though there still is the potential to have large amounts of memory tied up in dead but not reaped Pobj things. > With the seen hash approach, I wouldn't expect the hash itself to take > nearly as much space as the frozen structure; My experience tracing variable graphs in Perl 5 indicates otherwise. Dan