[ECOS] Doug Lea's malloc

Johan Cederbom jcederbom@logopak.se
Thu Sep 27 07:38:00 GMT 2007


Hi Andrew,

I've just spent a week with a similar problem (on another system).

You get the assertion because someone has written over the memory 
allocation structures, and the ASSERT/DEBUG flag in "dynamic memory 
allocation" -> ".. implemetations" -> "Doug Lea's" is enabled.
All allocated memory areas are separated by a simple "memchunk" 
structure. If a task wites more bytes than allocated, it will destroy 
theese "memchunk" structures. The assertion comes when trying to use the 
bad struct and that is always too late, the memory has already been trashed.

The tricky part is to find out who did it !

/Johan
 
Rick Davis wrote:
> Andrew,
>
> Sorry it took so long to get back.
>
> Here is the dump I get when calling setvbuf (stdout, NULL, _IONBUF, 0);
>
> ASSERT FAIL: <5>dlmalloc.cxx[815]void
> Cyg_Mempool_dlmalloc_Implementation::do_check_inuse_chunk()
> ((((mchunkptr)(((char*)(p))+((p)->size & ~0x1)))->size) & 0x1)
> ASSERT FAIL: dlmalloc.cxx        [ 815] void
> Cyg_Mempool_dlmalloc_Implementation::do_check_inuse_chunk()
> ((((mchunkptr)(((char*)(p))+((p)->size & ~0x1)))->size) & 0x1)
>
> Rick
>
>
> -----Original Message-----
> From: Andrew Lunn [mailto:andrew@lunn.ch] 
> Sent: Thursday, September 13, 2007 4:59 PM
> To: Rick Davis
> Cc: Ecos-Discuss
> Subject: Re: [ECOS] dOUG lEE'S MALLOC
>
> On Thu, Sep 13, 2007 at 03:42:36PM -0400, Rick Davis wrote:
>   
>> I am porting to a new Power-PC platform that has 256M of DDR on it. I am
>> using the latest snapshot (today as a matter of fact). If I call setvbuf
>> (stdout, NULL, _IONBF, 0), Doug's code complains throwing some sort of
>>     
> size
>   
>> assertion. If I don't call setvbuf but call show_memory, that complains
>> about other issues. If I use the simple malloc routines instead,
>>     
> everything
>   
>> works fine. Is there a memory size issue? Is something not being called in
>> the right order during initialization?
>>     
>
> Do you have a simple test case?
>
> I just tried running the synthetic target which a big heap. All the
> malloc tests pass. eg malloc4 produces:
>
> INFO:<Starting malloc4 test>
> INFO:<Iteration 0, arenasize=276507344, space free=276507324,
> maxfree=276507324>
> INFO:<Iteration 10, arenasize=276507344, space free=31489948,
> maxfree=29058556>
> INFO:<Iteration 20, arenasize=276507344, space free=108284148,
> maxfree=58859852>
> INFO:<Iteration 30, arenasize=276507344, space free=69580420,
> maxfree=65494596>
> INFO:<Iteration 40, arenasize=276507344, space free=1714036,
> maxfree=1714036>
> INFO:<Iteration 50, arenasize=276507344, space free=92251804,
> maxfree=38098124>
> INFO:<Iteration 60, arenasize=276507344, space free=111664980,
> maxfree=58928772>
> INFO:<Iteration 70, arenasize=276507344, space free=47689060,
> maxfree=36578764>
> INFO:<Iteration 80, arenasize=276507344, space free=77573924,
> maxfree=77573924>
> INFO:<Iteration 90, arenasize=276507344, space free=34070540,
> maxfree=23496868>
> INFO:<Iteration 100, arenasize=276507344, space free=29280524,
> maxfree=29280524>
> INFO:<Iteration 110, arenasize=276507344, space free=142085116,
> maxfree=100678860>
> INFO:<Iteration 120, arenasize=276507344, space free=92516524,
> maxfree=39697388>
> INFO:<Iteration 130, arenasize=276507344, space free=178518644,
> maxfree=110641924>
> INFO:<Iteration 140, arenasize=276507344, space free=95249636,
> maxfree=95249636>
> INFO:<Iteration 150, arenasize=276507344, space free=58732380,
> maxfree=31240340>
> INFO:<Iteration 160, arenasize=276507344, space free=154251700,
> maxfree=109160292>
> INFO:<Iteration 170, arenasize=276507344, space free=8964580,
> maxfree=5096676>
> INFO:<Iteration 180, arenasize=276507344, space free=129668932,
> maxfree=106951988>
> INFO:<Iteration 190, arenasize=276507344, space free=89131924,
> maxfree=89131924>
> INFO:<Iteration 200, arenasize=276507344, space free=198999364,
> maxfree=140538356>
> INFO:<Iteration 203, arenasize=276507344, space free=276507324,
> maxfree=276507324>
> PASS:<malloc4 test completed successfully>
> EXIT:<done>
>
> Here the heap is around 263Mbytes.
>
> What exactly are the assertion failures you are getting?
>
>      Andrew
>
>
>   


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



More information about the Ecos-discuss mailing list