Odd Heap Space problem
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   a_w
Posted On:   Tuesday, April 7, 2009 04:11 PM

I recently had to reinstall a new implementation of Java, which works fine except one of my programs suddenly began generating an "OutOfMemoryError: Java heap space" every time I run it (which it hadn't been doing right before the reinstall), and it does this even if I reduce the memory needs down to a fraction of what they had been. More strangely, larger programs work fine - e.g., I tested Runescape, which is an enormous, graphics-heavy game which takes forever to load even with broadband, but even that one runs fine - and at maximum detail. When I print out the memory stats when my own program runs, here's what I get: Total memory: 5177344 Initial free memory: 2675368 Free memory after garbage collect   More>>

I recently had to reinstall a new implementation of Java, which works fine except one of my programs suddenly began generating an "OutOfMemoryError: Java heap space" every time I run it (which it hadn't been doing right before the reinstall), and it does this even if I reduce the memory needs down to a fraction of what they had been. More strangely, larger programs work fine - e.g., I tested Runescape, which is an enormous, graphics-heavy game which takes forever to load even with broadband, but even that one runs fine - and at maximum detail.

When I print out the memory stats when my own program runs, here's what I get:

Total memory: 5177344

Initial free memory: 2675368

Free memory after garbage collection: 3239888

These numbers seem incredibly small given that my machine has 2 gigabytes of onboard memory.

My question is: how do I allow more memory for my program? I assume Runescape must be allocating more memory for itself than what my program is allowed, but I haven't been able to find any means of doing that in the online material I've looked at.

Please bear with me if this is a naive question.

Any help is greatly appreciated.

   <<Less

Re: Odd Heap Space problem (Addendum)

Posted By:   a_w  
Posted On:   Tuesday, April 7, 2009 08:21 PM

Update: interestingly, the latest attempt to run my program produces the following memory stats before it again chokes due to an alleged lack of heap space:

Total memory is: 66650112

Initial free memory: 60216

Free memory after garbage collection: 59250608

Yes, that's 59 megabytes available now - and it still doesn't run. As usual, bigger programs such as Runescape still run fine.

What the dickens is going on? My program used to run without a hitch before I reinstalled Java. In fact it also ran fine (and still does) on my older (obsolete, crummy) machine which has a lot less memory.

Please help.

About | Sitemap | Contact