On Thu, 07 Dec 2000  22:27:34 +0900, Ami Ganguli wrote:
> Ok, I'm trying to figure out how to use ruby objects withing my application server.
> 
> What I need is to create ruby objects outside the scope of the
> interpretor.  Certain objects will be long-lived (created at server
> config) and others will be attached to a specific request and should
> be cleanly and reliably freed when the request is finished.  
> 
> Looking inside eval.c I see macros for "PUSH_SCOPE" and "POP_SCOPE"
> that look promising.  Perhaps I can create a global scope for the
> long-lived stuff and an inner scope for each request.  But both
> those functions are private to eval.c, and look pretty cryptic (I'm
> not sure what they really do).
> 
> Is there a public interface that I can use to accomplish this?   Is
> there some other way to implement my own memory management?  Other
> suggestions?

You could use the Marshal module to serialize objects to/from any IO
stream, e.g. files, and rehydrate them when needed. Serialized objects
are orthogonal to Ruby instantiations and memory management.

	Michel