This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dlmalloc package realloc issue(?)


Hello, Mike.

Sorry, I was wrong:
upper layer's ::realloc(...) do this thing.

MJ> Hello, All.

MJ> It seems I've found the problem in Doug Lea's malloc implementation.

MJ> When calling realloc, algorithm should do the
MJ> following(Cyg_Mempool_dlmalloc_Implementation::resize_alloc)
MJ> :
MJ> 1. Try expand reallocation block to forward.
MJ> 2. Try shifting it to backwards.
MJ> 3. If none of the above mentioned methods work out,
MJ>    it should make malloc(new), memcpy(new, old, oldsize), free(old)
   
MJ> But it doesn't do that:

MJ> Cyg_Mempool_dlmalloc_Implementation::resize_alloc( ...)
MJ> {
MJ>    ...
MJ>    if (!prev_inuse(oldp)) // <-
MJ>    {
MJ>       ...
MJ>    }
MJ>    // couldn't resize the allocation any direction, so return failure
MJ>    MALLOC_UNLOCK;
MJ>    return NULL;
MJ>    ...
MJ> }

MJ> i.e if previous chunk is used,
MJ> algorithm returns NULL.

MJ> -- 
MJ> Regards,
MJ>  Mike                          






-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]