At 2:56 PM +0000 2/15/02, Alex Gough wrote: >On Thu, 14 Feb 2002, Dan Sugalski wrote: > >> To allocate memory that is GCable, call Parrot_allocate(interpreter, >> size). Then stash the pointer and size in your buffer header, or >> it'll go missing later. To resize a chunk of memory, call >> mem_realloc(interpreter, from, oldsize, newsize). > >Having to pass in the oldsize makes it very tricky to use wrappers >around around mem_realloc which work when code isn't in parrot, is it >not possible to have the memory pools themselves be a bit more like >malloc/realloc in tracking allocated sizes (I imagine they need to do >this anyway, if GC is to free chunks appropriately)?
Non-parrot code shouldn't be dealing with parrot-local memory that's GCable without knowing about parrot data structures, including the buffer structure. Since we may well (and will, to start) have a copying collector, lack of knowledge will lead to nothing but pain as we yank memory around. :) > > If your buffer header can't be reached from the root set, you'll end >> up having it reclaimed when a sweep is made. > >Which bits of a PMC count as being reachable from the root set? PMC registers, stack, PMC register stack, bookkeeping structures, and the global variable set. Everything should be reachable from there. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk