[Microbit-Python] Memory leak in print or string formatting

Damien George damien.p.george at gmail.com
Wed Jan 13 17:46:50 EST 2016


Hi Marc,

This bug is now fixed!  Latest version should work correctly.  I
tested it myself and I got up to 20,000 iterations :)  (And then
turned it off because I got bored, it never crashed.)

There is already a module to inspect the heap:

import micropython
micropython.mem_info(1)

Cheers,
Damien.


On Fri, Jan 8, 2016 at 9:49 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> On 08.01.2016 00:32, Damien George wrote:
>> Thanks for the bug report on this memory error.  I tracked it down to
>> string data not being zero'd out on initialisation (and hence keeping
>> a pointer around which prevented the GC from reclaiming some memory,
>> but in a very pathological way where all previous strings that were
>> created with str.format were linked in a chain).
>>
>> A fix will appear soon.
>
> Thanks for tracking this down, Damien.
>
> Would it be possible to add a micropython module function to access
> the current heap size and/or used memory on the heap ? Something
> which allows detecting such memory errors when running loops.
>
> I think that would help with detecting such memory leaks.
>
> Cheers,
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Experts (#1, Jan 08 2016)
>>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>>> Python Database Interfaces ...           http://products.egenix.com/
>>>> Plone/Zope Database Interfaces ...           http://zope.egenix.com/
> ________________________________________________________________________
>
> ::: We implement business ideas - efficiently in both time and costs :::
>
>    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>            Registered at Amtsgericht Duesseldorf: HRB 46611
>                http://www.egenix.com/company/contact/
>                       http://www.malemburg.com/
>
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit


More information about the Microbit mailing list