Tim said:
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.
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