Tools vs. Samples - Run jar in same or different jvm?

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

Moderators: roger, gloomyandy, skoehler

Tools vs. Samples - Run jar in same or different jvm?

Postby rvanderwerf » Tue Apr 08, 2014 4:26 am

I was curious how you get 'Tools' to appear on the GraphicsMenu? I was digging through the GraphicsMenu.java class and I see it spawns a separate JVM for running Samples, but it the jar counts as a 'tool' it runs it in the same jvm as the menu. - Edit - I did build EV3Menu.jar from master branch, and it seems the Tools menu appears now. It wouId seem since resources are so tight you would want to run the apps in the same JVM so it doesn't have to start/stop over and over and run 2 jvms? Is there a reason for this, perhaps the Samples due to memory leaks in in the DBusJava or ev3classes projects? tried making a /home/root/lejos/tools dir and put a sample jar in there but I don't see 'Tools' on the main menu (-EDIT- built my own EV3Menu.jar and it appears now),

Cheers,

Ryan
rvanderwerf
Novice
 
Posts: 27
Joined: Thu Mar 13, 2014 5:00 am

Re: Tools vs. Samples - Run jar in same or different jvm?

Postby gloomyandy » Tue Apr 08, 2014 9:06 am

Yes tools run in the same JVM samples and other user programs run in a new JVM instance. Why do we do this? Basically we trust the tools (we wrote them), everything else may need cleanup etc. By sharing the same VM we get fast startup for the tools. Also by running in it's own VM we can ensure that a user program gets the full Java environment (debug, shutdown hooks etc.), which is not possible/easy when running in a shared VM. Although the EV3 is small we have not really seen any issues with resources so far.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4042
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Tools vs. Samples - Run jar in same or different jvm?

Postby rvanderwerf » Wed Apr 09, 2014 2:55 am

Thanks for the response! Good to know there is a no reason they don't work (The samples seemed to work for me like this, and they run FAST!). I'm doing some work in Groovy for a workshop and running the apps in the same JVM is the only practical way to not have to re-load that stuff over and over again. I've had mixed success with something like GroovyServ (I keep running into OOM killer even limiting the heap to 20M while EV3Menu is already running), but really that's all unnecessary if I can load the groovy-all jar upon bootup and initialize only once with the EV3Menu.
rvanderwerf
Novice
 
Posts: 27
Joined: Thu Mar 13, 2014 5:00 am

Re: Tools vs. Samples - Run jar in same or different jvm?

Postby gloomyandy » Wed Apr 09, 2014 2:01 pm

As I said we do not recommend that you run user programs in the same JVM as the menu. Memory leaks and other issues will almost certainly result in the VM growing very large over time. You may also run into issues with other resources not being released correctly.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4042
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Tools vs. Samples - Run jar in same or different jvm?

Postby rvanderwerf » Thu Apr 10, 2014 5:41 am

Well I did get Groovy(2.2.2) running with decent results:
Sample app written entirely in groovy:
Using @CompileStatic in Groovy - startup 13 seconds, running under 'Files'
Using @CompileStatic running under 'Tools' - < 1 second
Without using @CompileStatic running under Tools' 32 seconds

Cheers
rvanderwerf
Novice
 
Posts: 27
Joined: Thu Mar 13, 2014 5:00 am


Return to EV3 Software

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

more stuff