java.lang.outOfMemoryError (completely SOLVED)

Ricardo Strausz <[email protected]> Fri, 25 Jul 2003 18:48:53 -0500
Newsgroups gmane.comp.web.webobjects.eof,gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Hola a tod@s.

Finally completely solved; the problem was that, processing tons of 
db-data in a Cocoa/EOF app, the JVM runs out of memory. The behavior 
was unexpected, but sometimes it throws an exception: 
"java.lang.OutOfMemoryError".

The first solution (first suggested by Chuck Hill) was to use 
NSAutoRealesePool; I found out that, surprisingly for me, the Java 
Bridge does a very good work on that: it uses the Garbage Collection in 
the Java side and retain/release paradigm in the ObjC side, and does it 
well (you do not have to take care of more details... as I did, 
erroneously ;^().

However, the question of assigning more RAM to the JVM was still open, 
and the Apple's document 
http://docs.info.apple.com/article.html?artnum=75496 was not of much 
help (it may work for WO and JavaClient, but  not in Cocoa/EO). However 
it suggested the actual solution: in Project Builder, under targets and 
with the main target selected, go to Info.plist Entries > Pure-Java 
Specific and add in the "Additional VM Options" text field something 
like

-Xms256m -Xmx256m

(This will give to your JVM 256Mb of memory instead of 64Mb, the 
default.)

Hope this will help future developers of the fascinating Cocoa/EO 
environment.

Suerte!

Dino
http://homepage.mac.com/strausz

p.s.: Is Apple going to support Cocoa/EOF in the near future ;^? May be 
in "WO to Panther"??