NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

#1 08-27-2008 23:02:50

KamelohAgain
Guest

Java Heap Error

Hey again - I was wondering if you knew anything about Java Heap Errors when it comes to either large canvases or multiple layer sizes. A few of my users have been o-mailing me about it and I'm guessing it has to do with the memory limits on Java/Applets.

Do you know anything about it or any workarounds on how to fix it?

#2 08-27-2008 23:54:27

KamelohAgain
Guest

Re: Java Heap Error

Nevermind, my girlfriend figured it out XD

Sorry about that smile

#3 08-28-2008 04:36:44

Waccoon
Administrator

Re: Java Heap Error

I'd be interested in knowing about this.  I don't know much about the JVM.

Offline

#4 08-28-2008 20:08:11

Viconia
Guest

Re: Java Heap Error

Hi, I'm Kameloh's girlfriend and I'm just posting because you said you were interested in knowing about this error.

I have written a tutorial on our website about how to fix the error: wwwoekakiart.com/heapspacefix.php

Basically, Java defaults to having 32 megabytes maximum of initialization memory for applets and 128 megabytes of maximum memory that applets can use. Although these memory limits work fine for the majority of applets on the internet, I have received a few complaints from users about having Java Heap Space Errors and it is because their drawings are using too much memory.

Oekakiart.com has a maximum canvas size of 1,680 x 1,680, and we have a few users who draw very large and use many layers so this is why they typically get this error. There is no other solution for this as far as I know other than getting the users who have this problem to alter the maximum amount of memory that java applets can use through their control panel.

I hope that this will be of some help to you in the future.

#5 08-29-2008 03:57:44

rainbow
Member

Re: Java Heap Error

Viconia wrote:

Hi, I'm Kameloh's girlfriend and I'm just posting because you said you were interested in knowing about this error.

I have written a tutorial on our website about how to fix the error: wwwoekakiart.com/heapspacefix.php

Basically, Java defaults to having 32 megabytes maximum of initialization memory for applets and 128 megabytes of maximum memory that applets can use. Although these memory limits work fine for the majority of applets on the internet, I have received a few complaints from users about having Java Heap Space Errors and it is because their drawings are using too much memory.

Oekakiart.com has a maximum canvas size of 1,680 x 1,680, and we have a few users who draw very large and use many layers so this is why they typically get this error. There is no other solution for this as far as I know other than getting the users who have this problem to alter the maximum amount of memory that java applets can use through their control panel.

I hope that this will be of some help to you in the future.

I have a feeling that this type of behaviour regarding the Java Heap Applet errors might be by design. I limited the size of the canvas to 999 x 999, increased the memory and appearently I still got the error. I might have to increase to as much as 512 MB since I have 4 GB of memory installed on my computer.

I was wondering if this Java heap error also affects Microsoft JVM.

(I'm working on getting the index.php file fixed as soon as possible, but I've been stuck in a whole regarding a parse error trying to fix the Thumb URL link to display [Unthumb] if the user has made a thumbnail out of a image.)

Offline

#6 08-29-2008 06:09:18

Waccoon
Administrator

Re: Java Heap Error

Thanks for the info.

I thought Java just scaled its stack and heap space dynamically like OSes do.  This slows performance, but running out of memory and crashing is NOT an option for an OS, even if it means the system has to slow to a crawl.

Offline

#7 08-29-2008 21:29:58

Viconia
Guest

Re: Java Heap Error

To be honest I wouldn't know if it affects the jvm but I did do some research on the subject and the only information I could find on how to fix the error is to add those parameters in the java control panel.

A user who messaged me was not able to open her picture ot retouch it in shi painter until I told her to add the parameters in and when she added it and tried opening her image again in shi painter it worked and she said she worked on it all day with no problems.

I also tested it myself. With an 800x800 pixel image at the default memory allowance (nothing entered in the parameters section) I got to around 14 layers and the image gave me a java heap size error. When I increased it to 256 megabytes I created a 1,000 by 1,000 pixel image and I got no heap size errors after 15 layers. I also covered each layer with colors and used the airbrush tool and monitored memory use of the applet through the java console and sure enough with every layer the memory use went up.

I also know from my own personal drawing experience that typically I draw at 800 x 800 pixels but only use 1-2 layers for my coloring so after 6 hours I don't get any java heap size errors, however when I create pictures that are even 600 x 600 if I go to around 10 layers it gives me a heap size error after 2 or 3 hours.

For example, when I did my first test at 128 megabytes of memory I monitored my memory use through the console and got this:

Memory: 5,776K  Free: 2,322K  (40%) ... completed.
Memory: 8,680K  Free: 2,281K  (26%) ... completed.
Memory: 19,560K  Free: 1,966K  (10%) ... completed.
Memory: 24,972K  Free: 4,453K  (17%) ... completed.
Memory: 37,820K  Free: 2,110K  (5%) ... completed.
Memory: 43,088K  Free: 3,076K  (7%) ... completed.
java.lang.OutOfMemoryError: Java heap space
      at paintchat.LO.setSize(Unknown Source)
      at c.P.init(Unknown Source)
      at c.ShiPainter.rInit(Unknown Source)
      at c.ShiPainter.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Garbage collect ... completed.
Memory: 97,600K  Free: 4,006K  (4%) ... completed.
java.lang.OutOfMemoryError: Java heap space
      at paintchat.LO.setSize(Unknown Source)
      at c.P.init(Unknown Source)
      at c.ShiPainter.rInit(Unknown Source)
      at c.ShiPainter.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)



However my second attempt yielded these results at 256 megabytes of memory allowed:

Memory: 37,768K  Free: 7,590K  (20%) ... completed.
Memory: 82,436K  Free: 28,620K  (34%) ... completed.
Memory: 96,336K  Free: 27,289K  (28%) ... completed.
Memory: 149,708K  Free: 53,141K  (35%) ... completed.
Memory: 224,332K  Free: 45,618K  (20%) ... completed.

#8 08-30-2008 00:06:22

rainbow
Member

Re: Java Heap Error

So it seems that if you allocate more memory for java...the applet itself should end up using less memory.

I have a feeling that I might have to increase the memory allocation to 512 MB to be safe.

Offline

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB