Memory differences between terminal and IDE

Discussion related to "under the hood" OpenMV topics.
User avatar
kwiley
Posts: 82
Joined: Fri Dec 21, 2018 5:22 pm

Memory differences between terminal and IDE

Postby kwiley » Fri Feb 01, 2019 9:46 pm

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?
User avatar
kwiley
Posts: 82
Joined: Fri Dec 21, 2018 5:22 pm

Re: Memory differences between terminal and IDE

Postby kwiley » Fri Feb 01, 2019 9:52 pm

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?
User avatar
kwagyeman
Posts: 2713
Joined: Sun May 24, 2015 2:10 pm

Re: Memory differences between terminal and IDE

Postby kwagyeman » Fri Feb 01, 2019 11:49 pm

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.
Nyamekye,
User avatar
kwiley
Posts: 82
Joined: Fri Dec 21, 2018 5:22 pm

Re: Memory differences between terminal and IDE

Postby kwiley » Sat Feb 02, 2019 12:09 am

I've written my own basic code minimizer already, but did you have a specific tool in mind?
User avatar
kwagyeman
Posts: 2713
Joined: Sun May 24, 2015 2:10 pm

Re: Memory differences between terminal and IDE

Postby kwagyeman » Sat Feb 02, 2019 2:17 am

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.
Nyamekye,
User avatar
kwiley
Posts: 82
Joined: Fri Dec 21, 2018 5:22 pm

Re: Memory differences between terminal and IDE

Postby kwiley » Sat Feb 02, 2019 12:22 pm

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

Return to “Technical Discussion”

Who is online

Users browsing this forum: Bing [Bot] and 4 guests