We have a serious problem with the IBM Java
Development Kit 1.4.2_06 und memory mapped IO via
nio and FileChannel.map.
The maximum heap space is set to 1GB,
the currently used memory (Runtime.totalMemory()) is
350MB, the file size 300MB. Seems to be uncritical
compared to the heap memory set. Nevertheless we always get
an IOException: Not enought memory available
Switching the JDK to SUN
or to 1.5 is unfortunately not possible
because we work in a very big project.
Has anyone an idea why this can happen?
Any help welcome,
Tim v.d.B.
Tim vor der Brück - 05 Jan 2006 21:09 GMT
> We have a serious problem with the IBM Java
> Development Kit 1.4.2_06 und memory mapped IO via
[quoted text clipped - 14 lines]
>
> Tim v.d.B.
I forgot to mention the machine has 4GB memory and
no other significant process is running except the
operating system and ours.
Ben_ - 05 Jan 2006 21:39 GMT
Not much I can say on this exact problem.
A few hints:
. activate verbose GC logs and review it
. apply recent JDK fixes (obtained from IBM support site)
. see the must gather for "out of memory", it contains useful tips
HTH.
Mark Thornton - 05 Jan 2006 22:44 GMT
> We have a serious problem with the IBM Java
> Development Kit 1.4.2_06 und memory mapped IO via
[quoted text clipped - 14 lines]
>
> Tim v.d.B.
You have probably out of address space. To memory map a 300MB file will
require 300MB of contiguous memory in your user address space. You have
used > 1GB with the heap. You don't say which OS, but on Windows the
user address space is at most 2GB and quite a bit of this is fragmented
by various DLLs. You also have the JVM to allow for. Try reducing the
maximum heap size to 500MB. You should then have plenty of remaining
address space. Note that specifying a maximum heap size of 1GB reserves
1GB of address space which can then not be used for memory mapping
(which is outside of the heap).
Regards,
Mark Thornton
Ben_ - 07 Jan 2006 09:35 GMT
Oh, I overlooked the fact that the file is 300 MB large, and yes,
fragmentation is the likely cause.
Reviewing the verbose GC logs will confirm.
If you're interested in understanding heap fragmentation issues, you'll want
to check the IBM JVM Diagnostic Guide at
http://www.ibm.com/developerworks/java/jdk/diagnosis. It's worth reading
anyhow.