Peter Jungreuthmayer

Coldfire: malloc does not work properly

Discussion created by Peter Jungreuthmayer on Oct 24, 2006
Latest reply on Oct 24, 2006 by no name
Hi all,
maybe an experienced CodeWarrior user could help me.
My system mainly consists of Coldfire MCF5207 and 64-MBit SDRAM (size 0x800000 at 0x40000000).
The xmap-file of my project reports:
#>40060210          ___heap_addr (linker command file)
#>0079FD00          ___heap_size (linker command file)
This should be ok.

When I allocate memory I get the following results:
 malloc(0x800000): 0x00000000
This is ok because the requested memory is greater than ___heap_size.

But when I try to allocate a bit less memory several times I get more memory than I have:
 malloc(0x700000): 0x400e8990 .. ok
 malloc(0x700000): 0x407e8998 .. not ok
 malloc(0x700000): 0x40ee89a0 .. not ok
 malloc(0x700000): 0x415e89a8 .. not ok
 malloc(0x700000): 0x               .. system locks

Once allocated memory can be freed without problems.

I have the following files linked to my application:
Is there anything I have missed (some kind of heap initialisation)?
Maybe somebody has a hint.

Best Regards

Message Edited by CrasyCat on 2007-04-13 01:31 PM