This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: dlmalloc package realloc issue(?)
- From: Mike Jastrebtsoff <mike at eltronix dot ru>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Mon, 25 Oct 2004 01:06:58 +0700
- Subject: Re: [ECOS] dlmalloc package realloc issue(?)
- Organization: Eltronix.ru
- References: <321327001.20041024232328@eltronix.ru>
- Reply-to: Mike Jastrebtsoff <mike at eltronix dot ru>
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