Search found 906 matches

by kevinkk525
Sat Sep 22, 2018 7:23 am
Forum: General Discussion and Questions
Topic: Remove imported module from RAM
Replies: 62
Views: 23303

Re: Remove imported module from RAM

The code of pysmartnode.networking.mqtt_receive_config takes about 200Bytes. The import statements a few kB which is asyncio. Of course I did not intend to get to the same amount of free RAM as before the import of the module as asyncio of course stays in RAM. My problem is, that no RAM gets freed i...
by kevinkk525
Sat Sep 22, 2018 7:03 am
Forum: General Discussion and Questions
Topic: [SOLVED] Unloading modules frees RAM only when unloading root package
Replies: 15
Views: 3654

Re: [BUG?] Unloading modules frees RAM only when unloading root package

It's not the same as the thread you linked to and that thread is a mess.

Here I'm talking about the difference of "from some import module" and "import some.module", which should behave the same way but don't.
by kevinkk525
Fri Sep 21, 2018 8:58 pm
Forum: General Discussion and Questions
Topic: Remove imported module from RAM
Replies: 62
Views: 23303

Re: Remove imported module from RAM

Of course they are, because I did not remove them after unloading the module. But they have nothing to do with no RAM getting freed at all when removing the module. But when importing like "import pysmartnode.networking.mqtt_receive_config", I'm able to unload the module and get some RAM back.
by kevinkk525
Fri Sep 21, 2018 8:32 pm
Forum: General Discussion and Questions
Topic: Remove imported module from RAM
Replies: 62
Views: 23303

Re: Remove imported module from RAM

All files are frozen bytecode.
If you look at the thread I linked, I described that

Code: Select all

 import some.module
and then deleting some.module does work in contrast to

Code: Select all

from some import module
. Even that does not work in my program but that's another thing..
by kevinkk525
Fri Sep 21, 2018 8:28 pm
Forum: General Discussion and Questions
Topic: Remove imported module from RAM
Replies: 62
Views: 23303

Re: Remove imported module from RAM

Sorry that I added these lines below.. it was all there: dir() ['uos', 'gc', '__name__', 'main'] >>> sys.modules {'main': <module 'main'>} >>> from pysmartnode.networking import mqtt_receive_config >>> dir() ['uos', '__name__', 'main', 'gc', 'sys', 'mqtt_receive_config'] >>> sys.modules {'uasyncio':...
by kevinkk525
Fri Sep 21, 2018 8:24 pm
Forum: General Discussion and Questions
Topic: Remove imported module from RAM
Replies: 62
Views: 23303

Re: Remove imported module from RAM

ok I ran it: dir() ['uos', 'gc', '__name__', 'main'] >>> sys.modules {'main': <module 'main'>} >>> from pysmartnode.networking import mqtt_receive_config >>> dir() ['uos', '__name__', 'main', 'gc', 'sys', 'mqtt_receive_config'] >>> sys.modules {'uasyncio': <module 'uasyncio'>, 'uasyncio.core': <modu...
by kevinkk525
Fri Sep 21, 2018 8:19 pm
Forum: General Discussion and Questions
Topic: Remove imported module from RAM
Replies: 62
Views: 23303

Re: Remove imported module from RAM

even after deleting pysmartnode, pysmartnode.networking and pysmartnode.networking.mqtt_receive_config the VM worked perfectly fine in my program. (pysmartnode.networking is empty) I opened a separete thread for this curiosity with some more explanations and observations: https://forum.micropython.o...
by kevinkk525
Fri Sep 21, 2018 8:19 pm
Forum: General Discussion and Questions
Topic: [SOLVED] Unloading modules frees RAM only when unloading root package
Replies: 15
Views: 3654

[SOLVED] Unloading modules frees RAM only when unloading root package

I was testing unloading modules to free up RAM that is allocated by functions I only need once. Then I realized that unloading modules behaves very weird and therefore does not really work in a normal environment. Expected behaviour: from some import module1 from some import module2 del module1 del ...
by kevinkk525
Fri Sep 21, 2018 8:10 pm
Forum: General Discussion and Questions
Topic: Remove imported module from RAM
Replies: 62
Views: 23303

Re: Remove imported module from RAM

>>> dir() ['uos', 'gc', '__name__', 'main'] >>> import sys >>> sys.modules {'main': <module 'main'>} >>> import gc >>> gc.collect();gc.mem_free() 35520 >>> from pysmartnode.networking import mqtt_receive_config >>> dir() ['uos', '__name__', 'main', 'gc', 'sys', 'mqtt_receive_config'] >>> sys.module...
by kevinkk525
Fri Sep 21, 2018 8:04 pm
Forum: General Discussion and Questions
Topic: Remove imported module from RAM
Replies: 62
Views: 23303

Re: Remove imported module from RAM

>>> import sys >>> import gc >>> gc.collect();gc.mem_free() 22480 >>> from pysmartnode.networking import mqtt_receive_config >>> gc.collect();gc.mem_free() 18112 >>> del mqtt_receive_config >>> del sys.modules["mqtt_receive_config"] Traceback (most recent call last): File "<stdin>", line 1, in <mod...