Mysterious outofmemory error..?

As far I know it is necessary to use direct buffers when loading a texture using glTexImage2D.

This works fine with small textures.

But, the problem occurs when I am using ByteBuffer.allocateDirect to allocate a texture that is 4096x4096 pixels, with four bytes per pixels. It returns an outofmemoryerror. But this is only 64mb!

And, I know it is plenty of memory available! I have one gigabyte of physical memory, and god knows how much swapdisk space.

Allocating the same amount of memory using conventinal Java allocation methods is fine, I can even double it and more, no problem. So, the amount of free memory cannot be the problem, it is a problem with the case of direct buffer allocation through NIO.

I tried to use

-XX:MaxDirectMemorySize=1280m
and
-Xmx1400m

as VM parameters, but it seems like they have no effect whatsoever. I also tried multiple VMs:

1.4.1_07, 1.4.2_03 and the latest 1.5.

I am running Windows 2000, with all the latest drivers etc installed.

Anyone have any idea what is going on here?? ???