aspose file tools*
The moose likes Java in General and the fly likes OutOfMemory error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "OutOfMemory error" Watch "OutOfMemory error" New topic
Author

OutOfMemory error

Chad McGowan
Ranch Hand

Joined: May 10, 2001
Posts: 265
I am continuously getting outofmemory errors when loading large amounts of data(ie, iterating through hourly temperatures for 20 years). Is there a way to tell how much memory is being used at a certain point in my program? This would help with debugging and also help me to set a limit on data read in at once. Thanks
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Use the JVM option <code>java -verbose:gc</code> - this will cause the system to print memory usage information every time it does garbage collection. You may also find it useful to increase the memory allocated to the JVM using the -Xmx option. See the documentation here for more details, assuming you're using JDK 1.3 for Windows. Otherwise find the appropriate documentation for your JVM - there's probably something similar.
[This message has been edited by Jim Yingst (edited June 08, 2001).]


"I'm not back." - Bill Harding, Twister
Aj Manch
Ranch Hand

Joined: May 07, 2001
Posts: 50
Originally posted by Chad McGowan:
I am continuously getting outofmemory errors when loading large amounts of data(ie, iterating through hourly temperatures for 20 years). Is there a way to tell how much memory is being used at a certain point in my program? This would help with debugging and also help me to set a limit on data read in at once. Thanks

Chad,
How do you define 'certain point'? If you want to find out the peak memory consumption you can probably toy around with performance monitor on the Windows Task Manager. Jim has a good solution but not sure if you can find out the peak memory consumption.
AJ
Chad McGowan
Ranch Hand

Joined: May 10, 2001
Posts: 265
Jim's solution helped me solve my problem. Thanks Jim. Using verbose:gc, I could see approximately how much memory was being used with each data load.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: OutOfMemory error