This is the mail archive of the ecos-discuss@sourceware.org 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: Two minor memory allocation issues


On Tue, May 16, 2006 at 11:15:02AM +0100, Andy Jackson wrote:
> I've just been experimenting with memory allocation (malloc and friends) on 
> eCos and have spotted two minor issues:
> 
> 1. A malloc request for 0x7FFFFFFF bytes succeeds and allocates a small 
> amount of memory. Reducing the request to 0x7FFFFFF0 causes it to fail as 
> expected. My guess is that this is a function of the allocation padding 
> calculation, but I haven't got time at present to investigate further.

It looks like internally dlmalloc is using cyg_int32 to represent
size. There is a macro request2size() which does arithmatic on the
size and 0x7FFFFFFF it is probably wrapping around to negative and so
it allocates the minimal amount of space. 

 
> 2. In the reference manual section 'eCos Memory Pools' on the page for 
> 'stdlib malloc Pools, the prototype for calloc is given as:
> 
> void *calloc(size_t size);

Yes, this is wrong. I will update the documentation.

     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


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