Applet can take more than 600m, -Xmx256m has set ? [SOLVED]

Hello,

I have my applet " http://temp4322.dy.fi/AsiakasOhjelma.html ",
when i keep my applet running the memory of JAVA program rises 1m a second to well over 600m, i dont understand why this is possible as i have set my -Xmx256m to 256m ?

Why applet takes more memory what is set, i also has System.gc () at some points of my code, but it wont release the memory what Linux Mint 11 wants for JAVA, have i miss understood the -Xmx option ?

couls you just post your whole VM arguments string, all those parameters ?

maybe you just spelled soemthing wrong, and in that case it doesn’t work.
And if I don’t set the memory in my apps, the System outputs wrong memory numbers which are very high, its all screwed up then

here,

The Linux tag,

<div style="position:absolute;top:1%;left:1%;width:98%;height:97%;">
<applet code="main.Main"
codebase="http://bittipankki001.com/AsiakasOhjelma/"
archive="AsiakasOhjelma.jar"
width="100%"
height="100%">
<param name="separate_jvm" value="true">
<param name="java_arguments" value="-Xms32m -Xmx256m -Dsun.java2d.d3d=false -Dsun.java2d.opengl=true -Djnlp.packEnabled=true">
</applet>
</div>

Have you looked at your program, while it is running, with a profiler? JVisualVM.exe comes with Java and is quite good for tracking down memory leaks. It can be found in the JDK/bin folder.

arguments string, seems fine

point is, even with memory leaks, a java program with max 256M should get a OutOfMemoryError way before 600M

I don’t really work with applets though…

That’s just the Java heap it limits. The rest of the memory is “native” heap, stack, JVM itself, any mapped files, and direct bytebuffers, of which there are probably quite a few. And it might not all be physical RAM anyway, some of it’s likely to be virtual.

Cas :slight_smile:

Direct ByteBuffers,

I had the following line of code at my nio code, i had it nulled later, and at the start of my method it was installed again, i had forget it to inside a method, it is now on global area, it made my VM to collect garbage a bit less than 1M a second, sometimes it stopped the garbage collection, but started again later, i noticed the problem when my memory was running out, my VM still takes a small rise on memory requirements at times, but it is not that heavy problem anymore, my JAVA seems to take a some what a 109m currently, i keep my program running next nigth and check again tomorrow, thanks for pointing me this bytebuffer, i would not had found this line alone, thanks …

ByteBuffer buf = ByteBuffer.allocateDirect ( 2048 ) ;

Yes, direct bytebuffers are meant to be used in specific ways. Generally you allocate one and expect it to remain allocated for a long long time.

Cas :slight_smile: