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]

dlmalloc package realloc issue(?)


Hello, All.

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

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

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

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

-- 
Regards,
 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]