[Microbit-Python] Heap size

Damien George damien.p.george at gmail.com
Sun Nov 8 13:07:36 EST 2015


There is also an mbed heap (currently 2k) so I found the best thing to
do for the uPy heap is to just use a static buffer in the BSS (as per
mprun.c).

Mark: you can try reducing the size of the mbed heap to give us more
room.  Ultimately the best thing to do is combine the heaps, but
that's non trivial (since C++ new's use the mbed heap, you'd have to
hook into that).  So I think just reducing the size of the mbed heap
is the easiest, especially if it only allocates on startup, we can
determine how much it actually needs.

Anyway, to answer the question: 9820 came from increasing the number
by units of 16 bytes until it didn't fit anymore :)


On Sun, Nov 8, 2015 at 5:44 PM, Dave Hylands <dhylands at gmail.com> wrote:
> How much RAM does the microbit have?
>
> Based on the the 9820, I'm going to guess 16K.
>
> The normal memory layout is that you have global variables, heap, and stack.
> The heap and stack grow towards each other, so the stack is normally starts
> at the highest possible memory address and grows downwards and the heap
> starts immediately after the global variables.
>
> Was a linker map produced as part of the build?
>
> On Sun, Nov 8, 2015 at 4:59 AM, Mark Shannon <mark at hotpy.org> wrote:
>>
>> Hi,
>>
>> I guess this is a question for Damien.
>> How is the size of the GC heap determined?
>>
>> The code is here
>>
>> https://github.com/bbcmicrobit/micropython/blob/master/source/microbit/mprun.c#L78
>> but where does the magic constant 9820 come from?
>>
>> I'm planning on doing some experiments with a cut-down version of the DAL,
>> and I would like to see how much more heap we can get.
>>
>> Cheers,
>> Mark.
>> _______________________________________________
>> Microbit mailing list
>> Microbit at python.org
>> https://mail.python.org/mailman/listinfo/microbit
>
>
>
>
> --
> Dave Hylands
> Shuswap, BC, Canada
> http://www.davehylands.com
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>


More information about the Microbit mailing list