Page 7 of 7

Re: Remove imported module from RAM

Posted: Sun Sep 23, 2018 4:59 pm
by kevinkk525
oh I did not see that file the first time. The file is 2MB big, has a lot in it. QSTRs of all my modules and strings, a lot of (const bytes*), a lot of these:

Code: Select all

// frozen bytecode for file _testing/utils/subscribe_file.py, scope _testing_utils_subscribe_file__lt_module_gt__printMemory
STATIC const byte bytecode_data__testing_utils_subscribe_file__lt_module_gt__printMemory[53] = {
    0x08, 0x00, 0x00, 0x01, 0x00, 0x01, 0x0c,
    MP_QSTR_printMemory & 0xff, MP_QSTR_printMemory >> 8,
    MP_QSTR__testing_slash_utils_slash_subscribe_file_dot_py & 0xff, MP_QSTR__testing_slash_utils_slash_subscribe_file_dot_py >> 8,
    0x81, 0x11, 0x20, 0x29, 0x33, 0x00, 0x00, 0xff,
    0x1c, MP_QSTR_gc & 0xff, MP_QSTR_gc >> 8,
    0x1e, MP_QSTR_mem_free & 0xff, MP_QSTR_mem_free >> 8,
    0x66, 0x00, 
    0xc1, 
    0x1c, MP_QSTR_print & 0xff, MP_QSTR_print >> 8,
    0x17, 0x01, 
    0x1e, MP_QSTR_format & 0xff, MP_QSTR_format >> 8,
    0xb0, 
    0xb1, 
    0x1c, MP_QSTR_memory & 0xff, MP_QSTR_memory >> 8,
    0xf2, 
    0x66, 0x02, 
    0x64, 0x01, 
    0x32, 
    0xb1, 
    0x25, MP_QSTR_memory & 0xff, MP_QSTR_memory >> 8,
    0x11, 
    0x5b, 
};
I guess I should not post all of it :D

frozen.c however is completely empty.

Re: Remove imported module from RAM

Posted: Mon Sep 24, 2018 1:19 am
by jickster
Ok then you’re doing all you can to save RAM.

If your .py in frozen_mpy.c doesn’t create any objects when being imported - lists, etc - it should occupy almost no RAM.



Sent from my iPhone using Tapatalk Pro

Re: Remove imported module from RAM

Posted: Mon Sep 24, 2018 7:42 am
by kevinkk525
I try to avoid having lists as they have to be reallocated when appending items, but I have a lot of classes, class instances and functions.