Hi - I'm using NetBeans 5.5 and in my
Java program am loading a few arrays into memory which total around 70MB. At a point a I get an OutOfMemoryError regarding the heap space. I have a Windows XP machine with 1GB RAM. It seems that the logical solution is to increase the initial and maximum heap memory; NetBeans documention seems to instruct one to do this using the flags -J-Xms128m -J-Xmx256m (to make the initial and maximum memory 128MB and 256 MB, respectively) either a) after netbeans.exe if launched from the terminal window or b) in a line of the netbeans.conf file if launched from a shortcut (netbeans_default_options="-J-Xms128m -J-Xmx256m).
Anyway I've tried this many times both ways and it seems that it has no effect. Using
Runtime.getRuntime().freeMemory() and
ManagementFactory.getMemoryMXBean methods in my program, I see that the total memory stays at 65,769,472, the initial heap memory is zero, and the max heap memory is 66,650,112 no matter how I start Netbeans. I can't seem to get the heap to be as large as I need. I don't believe I have any large background programs running, and the Windows Task Manager seems to show a lot of available memory (e.g. over 400MB Available Physical Memory - I don't know why it's not even more but this sounds ample).
Any suggestions? One thing I tried was to allow for no paging file under Control Panel/System/Advanced/Performance/Settings/Advanced, but this made no difference and I was surprised that after rebooting the "PF Usage" on the Task Manager Performance tab shows about 514MB. I don't know whether this is relevant to the problem; generally it seems I should be able to load 70MB of data into memory given my 1GB of RAM.
Thanks for reading this.
Jonathan Glass