Author Topic: Applet OutOfMemoryError problem  (Read 2053 times)

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
Applet OutOfMemoryError problem
« on: December 01, 2006, 04:51:05 pm »
Is there any way to solve such a problem?
If my 3ds and md2 files contains many objects (i.e. 1000), or my textures are big, the jPCT will cost much memory to load these resources. And when the program is compiled as Applet to use in client web browsers, the memory requested will greater than the default heap size of the JVM of client ( 64M), so any body has any solution about this issue?
Thanks a lot.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Applet OutOfMemoryError problem
« Reply #1 on: December 01, 2006, 04:59:47 pm »
You may try to set Config.glAvoidTextureCopies=true and Config.saveMemory=true as the very first commands in your code. Maybe this helps enough to stay within 64m.

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
Applet OutOfMemoryError problem
« Reply #2 on: December 01, 2006, 05:06:53 pm »
Doesn't work.
Does that mean the only way to solve this problem is to reduce the number of the objects in 3ds file or to use Web Start instead of Applet?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Applet OutOfMemoryError problem
« Reply #3 on: December 01, 2006, 07:48:18 pm »
Webstart is the better solution anyway. Maybe the applet can work with lower detail textures and webstart can be used as a higher quality option. It doesn't seem to be possible to increase the memory from the page that starts the applet, which is a real shame. Here's what i found regarding this topic (directly from sun):

As for your second question, heap/stack/gc memory management for your JRE can be sent by setting the JRE's supported arguments. You can do this via the Java Control Panel or by setting the deployment.javapi.jre.<version>.args property in deployment.properties. W3C's OBJECT and APPLET tags currently do not have any attribute for JRE memory management. We may consider revisiting the tags' attribute to investigate the possibility of supporting the setting of the JRE's arguments. Remember, because only one instance of the JVM exists in a browser session, once the JRE arguments are set, the setting arguments will be in effect for the entire browser process's life.