Hello Duncan,

You have to create the heap yourself if the standard 1kB is not enough.
Copy heap.s into your project dir and modify it to create your preferred
size. Then assemble it and link with your project.

Unlike the mcs51 heap which is defined in _heap.c this is not documented
for Z80 in the manual. Feel free to request a documentation update or
merge of _heap.c and heap.s in the tracker system.

Maarten

> Hi,
>
> I've just started using SDCC, compiling for the Amstrad CPC 464 (Z80
> CPU, 64kB RAM).
>
> The following code:
>
>   void *block = (void*)0;
>   long size = 0;
>
>   while (1)
>     {
>       size += 128;
>       block = malloc(size);
>       if (block == (void*)0)
>       {
>         printf("done\r\n");
>         break;
>       }
>       else
>       {
>         printf("%ld\r\n", size);
>         free(block);
>       }
>     }
>
> ... is only ever able to malloc() 896 bytes, producing the following
> output:
>
> 128
> 256
> 384
> 512
> 640
> 768
> 896
> done
>
> --
> Duncan Bayne
> ph: +61 420817082 | web: http://duncan-bayne.github.com/ | skype:
> duncan_bayne
>
> I usually check my mail every 24 - 48 hours.  If there's something
> urgent going on, please send me an SMS or call me at the above number.
>


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to