Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is the memory immediately freed after executing pgm in one JVM ?

 
Steve Mutanson
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a batch file doing the following thing ---
************
java MyApp arg_1
java MyApp arg_2
...
...
java MyApp arg_99
java MyApp arg_100
*************
I found the speed was fast in the beginning but it significantly slows down when it reaches "java MyApp arg_80". SInce each "java MyApp. . .." invokes a new JVM, I suspect that when the batch file reaches "java MyApp arg_80" some previously created JVM have NOT been really cleaned up in the memory yet, i.e. some of the previously created JVM are still occupying the memory space so the memory is gradually occupied fully, and this causes the slowing down of the newly created JVM.
Does this make sense ? I am not sure. Theoretically when a "java MyApp arg_n" is done, the OS should free the memory it occupies, right ? So, does what I said in last paragraph make sense ?
Thanks,
steve
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The memory allocated by a JVM does exist at the operating system level for some time after the JVM terminates. The OS has to notice that the program has terminated, then it takes some time to free what has been allocated (i.e. swap space or virtual memory, RAM, file descriptors, sockets and so on). In your situation it sounds like you don't have enough RAM in your computer to keep up with all the processes and your OS is bogging down cleaning up old processes and allocating resources for the new processes. You can monitor your system's resource allocation with tools like System Monitor and Task Manager in Windows NT-XP-2000 or 'ps' or 'top' on a Unix system.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic