Internal JVM Memory Management

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

Enginecrafter
New User
Posts: 24
Joined: Mon May 09, 2016 3:33 pm

Internal JVM Memory Management

Postby Enginecrafter » Fri Nov 03, 2017 9:18 pm

Hello.

I have spent quite a bit time developing in java for lejos. But I can't stop thinking about one thing.
The EV3 brick has only 64MiB of RAM. For simple programs that is enough, but what about for larger programs?
Should I be afraid and always try to minimze the RAM usage by eliminating useless features or let it be?
At the startup, the lejos menu itself is using around 52MiB of space, so we have 12MiB to go.
I also tried to setup swap space around 128MiB, but it was not working. The kernel wasn't swapping the memory at all.

Question Summary:
Is there real need to be concerned about JVM memory usage?

User avatar
gloomyandy
leJOS Team Member
Posts: 5899
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Internal JVM Memory Management

Postby gloomyandy » Fri Nov 03, 2017 9:28 pm

I'd wait until you have hit a problem before you worry about it! I've never had memory issues on the EV3. Are you sure that the menu system is really taking 52Mb of physical memory? Some of that may be uncommitted pages. I suspect that you will also find that a good chunk of that will be code pages for the JVM that will end up being shared with the JVM used by your program. Similarly swap space is only needed for pages that get written to. Code pages are paged directly from the executable file. We also configure the JVM so that it will share byte code (from the standard classes) between instances of the VM.

We managed surprising well on the NXT and that only had 64Kb!
leJOS news https://lejosnews.wordpress.com/

Enginecrafter
New User
Posts: 24
Joined: Mon May 09, 2016 3:33 pm

Re: Internal JVM Memory Management

Postby Enginecrafter » Fri Nov 03, 2017 11:46 pm

Oh, thanks for excellent explantion!
I didn't know the NXT had only 64kb of memory. If it could run here,
on 64MB it wouldn't be a problem. Thanks for your time :D .
(BTW I thought it is taking 52MiB of physical memory because "free" command in ssh or telnet showed that)


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 1 guest