Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes caching windows exe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "caching windows exe" Watch "caching windows exe" New topic
Author

caching windows exe

Frank Tap
Greenhorn

Joined: Jan 11, 2013
Posts: 1
I am running a windows exe using Runtime.getruntime().exec. This works fine. However I am running the same exe hundreds of time and I would like to keep it in memory. The exec command deletes the tread after it is finished. Is there a way to keep the process in memory after it is finished and run it again?
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2280
    
  28

No. Everytime you run a process, the OS has to do the work of loading the code in memory, allocating the heap, etc, etc. An application that forks a heavy process won't scale. If possible you are better off moving that logic to a background process that stays running and listens on a port for requests. Your main application can send a request to the background process whenever it needs the work to be done.

Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7554
    
  18

Frank Tap wrote:I am running a windows exe using Runtime.getruntime().exec. This works fine. However I am running the same exe hundreds of time and I would like to keep it in memory. The exec command deletes the tread after it is finished. Is there a way to keep the process in memory after it is finished and run it again?

And further to Jayesh's good advice, I'd suggest that this sort of micro-optimization is way premature, and probably harmful - especially for something that only runs hundreds of times.

Hundreds of millions of times - then it might be worth thinking about; but only if you can prove that it actually has a significant benefit.
W.A. Wulf wrote:More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason — including blind stupidity.

Winston
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: caching windows exe
 
Similar Threads
Cannot start Apache Tomcat as a Windows Service
Mutiple Instances of a server
Applet runs in eclipse, but when I embed it in html, it doesnt work
The Gone.scr virus has struck
tomcat6 memory in the windows task bar