[Microbit-Python] another maximum size of program thread

Nicholas H.Tollervey ntoll at ntoll.org
Thu Jun 30 09:54:55 EDT 2016


Jeff,

A quick thought. If it's script length that's the problem, you could
just use the file-system. Viz:

https://microbit-micropython.readthedocs.io/en/latest/tutorials/storage.html#mainly-main-py

Hope this helps,

N.

On 30/06/16 14:47, Jeff Young wrote:
> Hi All
> 
>  
> 
> First time posting here.  Checked the archives and found my exact
> problem outlined in a thread titled ‘Maximum Size of Microbit Python
> Program’ from Jun ’16.
> 
> I’ve tried a few things and I’m hitting the ‘size of script’ memory
> problem as outlined in a post from Nicholas Tollervey.  Runtime memory
> is fine.
> 
>  
> 
> The program never starts and I just see;
> 
>  
> 
> MemoryError: memory allocation failed, allocating 3688 bytes
> 
> MicroPython v1.7-9-gbe020eb on 2016-04-18; micro:bit with nRF51822
> 
>  
> 
> The thread doesn’t really reach any solutions so I was wondering if
> anyone had found a workround ?  I’ve tried Mu and online editors.  Same
> result.  I’m seeing the messages via REPL in Mu
> 
>  
> 
> My program is 127 lines working but add in another 8 lines and it
> breaks.  No comments in the code ;-)
> 
>  
> 
> As an aside I originally wrote it using python classes and objects but
> found I quickly hit the runtime error limit after about 3 or 4 objects. 
> Rewrote with simple lists and we’re up to 20 objects before hitting the
> runtime limit.  I’m thinking classes/objects consume a lot of memory. 
> Also lists-of-lists seem quite memory hungry.
> 
>  
> 
> It would be great to be able to see how much memory is being
> consumed/free during runtime.  Great to be able to see the size of
> objects etc in memory.
> 
>  
> 
> I’m also wondering it there is some way to re-balance the memory
> partitioning between the block of memory that holds the code and the
> runtime memory ? ie take a few kb from the run time partition and add it
> to the code partition ?
> 
>  
> 
> Thanks
> 
>  
> 
> Jeff
> 
>  
> 
>  
> 
> 
> 
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
> 
are you in a meeting @be

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/microbit/attachments/20160630/0252def7/attachment.sig>


More information about the Microbit mailing list