Memory differences between terminal and IDE

When I run my program from the IDE, it currently runs out of memory while pulling in the imports, before actually doing any work, so to speak. Admittedly, I pull in some modules that I wrote, not just “stdlib” like stuff. But if I copy/paste those exact initial import statements into a screen session, it survives. Some memory is being allocated differently from an IDE session than from a terminal session. I’m not sure which scenario more closely reflects what I should expect from a boot session (off main.py for example), but right now I’m focused on the fact that the IDE behaves differently than the terminal.

Thoughts?

Well, I guess it works if I pull those imports into a new blank file. So the length of the file is part of the problem. I guess it tries to put the file in memory before processing the imports or something like that. Does that sound right?

Yes, the IDE allocates a string for the file and then paraes it so the file has to fit in RAM. When the file is one disk it’s parsed line by line which is less ram since it gets turned into byte code immediately. Um, you may wish to minify your libs before saving them to the OpenMV Cam.

I’ve written my own basic code minimizer already, but did you have a specific tool in mind?

Um, that should be all you need. The IDE has a built-in strip white space and comments option when you save the script via tools.

Ah, mine’s already tighter than that. It reduces variable names, replaces constants, etc. Okay, no worries.