On Wed, Oct 02, 2002 at 02:01:48PM +0200, Leopold Toetsch wrote:
> As already posted I incorparated the allocator from 
> http://gee.cs.oswego.edu/dl/html/malloc.html
> in parrot.
> 
> Some remarks:
> - it's totally stable now, runs all tests (parrot and perl6)
> - memory consumption is like CVS or much less ...
> - ... if resources.c is unpatched (#17702)
> - runs almost[1] everything in almost the same time

> And last but not least, LEA allocator doesn't invalidate pointers due to 
> copying data around (except realloc of course) - so e.g. hash.c or 
> others could be optimized.
> 
> Please have a closer look at it.

>  void
>  add_free_buffer(struct Parrot_Interp *interpreter, 
> -                struct Small_Object_Pool *pool, void *buffer)
> +                struct Small_Object_Pool *pool, void *buff)
>  {
> -    ((Buffer *)buffer)->flags = BUFFER_on_free_list_FLAG;
> +    Buffer * buffer = buff;
> +    if (buffer->bufstart && !(buffer->flags &
> +                (BUFFER_COW_FLAG|BUFFER_external_FLAG))) {
> +        free(buffer->bufstart);
> +    }
> +    buffer->bufstart = 0;
> +    buffer->flags = BUFFER_on_free_list_FLAG;
>      /* Use the right length */
> -    ((Buffer *)buffer)->buflen = 0;
> +    buffer->buflen = 0;

The article doesn't mention garbage collection at all, and neither your
remarks nor your patch explains how it is now done. Is all garbage being
collected via that one free(buffer->bufstart); in the patch above?

I'm confused, and would appreciate hints about how to become less confused.

Nicholas Clark

Reply via email to