At 2:33 PM +0100 6/14/04, Nicholas Clark wrote:
On Mon, Jun 14, 2004 at 08:53:10AM -0400, Dan Sugalski wrote:
 At 12:53 PM -0500 6/13/04, Matt Fowles wrote:
 >Nicholas~
 >
 >I will try to answer what I can, based on my current experience
 >making those array PMCs.
 >
 >
 >Nicholas Clark wrote:
 >
 >>a data pointer
 >>       which I can use. I am always responsible for freeing anything
 >>       there(?)
 >>       and to do this I need to set the active destroy flag(?)
 >>       This flag is not the same as the high priority DOD system(?)
 >>       Does the garbage collector ever consider this pointer?
 >>       Does it ever chase what it points to?
 >>
 >You are responsible for freeing it by setting the active destroy flag.

 Well... no. You're not. If the memory hanging off the data pointer
 was allocated from one of parrot's managed pools (either free memory
 or pmc/buffer header) then you don't have to free it.

There's a memory internals document, but I can't spot any document given an API overview on how to allocate memory this way.

Yeah, it's all kinda ad-hoc. Needs fixing.

The implication of what you're saying is that the data pointer is checked by
the DOD, and any PMC it points directly to isn't dead.

Well... sort of. Checking and cleaning up are two very separate things here. Parrot may not automatically check (leaving that to your PMC's custom mark routine) but will automatically clean up. (If you've not marked in your custom mark routine)


Basically, if the right flags are set, the DOD trace will treat the pointer as pointing to something it should consider, and automatically trace into it. If the right flags aren't set it won't, and your needs to mark it explicitly.

Regardless of anything else, the DOD sweep will reclaim the PMC/String/Buffer/PObj structures if they aren't marked in the mark phase, either automatically or by a PMC mark routine, and memory not pointed to by a live buffer-ish thing will get reclaimed, so if your PMC with custom stuff hanging off the data pointer dies parrot will still reclaim its memory and whatnot for you.
--
Dan


--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to