Skip to main content

JVM memory settings

11 replies [Last post]
manenkov
Offline
Joined: 2008-01-04
Points: 0

Hello all!

How I can set a available memory amount for CVM? (something like -xmx & -xms)?

I using a hsqldb, and when I select a several thousands of rows, application crash (under Windows Mobile). I run this program on jre1.6 with settings -xms2m -xmx2m, and then I trying to select a several thousands of rows, I got a OutOfMemoryException.

But handheld device has a 128mb of memory...Can I use all of this memory?

Thanks for help.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> No, a lib catalog is places on root, and, as I say, a lnk below is running ok:
>
> 250#\phoneme\personal\bin\cvm.exe -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.pinsource.mffm.Main"
>
>

Hi manenkov,

Try using -Xbootclasspath/a (append) instead of -Xbootclasspath by
itself (which means override), and try putting each item on the
-Xbootclasspath/a by itself on a line, and for -classpath use ":"
instead of ";" for the separator.

Ex.

test.lnk
---
01#"\phoneme\personal\bin\cvm.exe" -f "\phoneme\personal\test-args.txt"

\phoneme\personal\test-args.txt
---
"-Xbootclasspath/a=/lib/btclasses.zip"
"-Xbootclasspath/a=/lib/personal.jar"
"-Xbootclasspath/a=/lib/naming.zip"
"-Xbootclasspath/a=/lib/jdbc1.zip"
-classpath "/Storage Card/lib/hsqldb.jar:/Storage Card/MFFMTechDemo.jar"
"com.pinsource.mffm.Main"

What happens when you try the above?

> The ClassNotFound exception is exception, catching and showing in my app. My build a Phoneme (http://www.cs.kuleuven.ac.be/~davy/phoneme/dist/Personal_Profile-phoneme...)
> han no any console for showing errors, and app just not started is ant errors presents (or abort without any message). So I can`t check the that is happens exaclty...
>
> I trying it on WM emulator with 128mb RAM.
>
> If you have a build of Phoneme with DEBUG option, can I get it? It will be very useful for me.

There is no debuild build binary available. So you will have to build
it yourself or maybe Davy P. has one available.

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

manenkov
Offline
Joined: 2008-01-04
Points: 0

If I using a ":" instead of ";" in classpath, the app is not started.
If I using a ";" ,app is started normally and all libs is loaded:

-Xbootclasspath/a=/lib/btclasses.zip
-Xbootclasspath/a=/lib/personal.jar
-Xbootclasspath/a=/lib/naming.zip
-Xbootclasspath/a=/lib/jdbc1.zip
-classpath "/Storage Card/lib/hsqldb.jar;/Storage Card/MFFMTechDemo.jar"
com.pinsource.mffm.Main

and next config is work:
-Xopt:useLargeMemoryArea=true
-Xmx64m
-Xms4m
-Xbootclasspath/a=/lib/btclasses.zip
-Xbootclasspath/a=/lib/personal.jar
-Xbootclasspath/a=/lib/naming.zip
-Xbootclasspath/a=/lib/jdbc1.zip
-classpath "/Storage Card/lib/hsqldb.jar;/Storage Card/MFFMTechDemo.jar"
com.pinsource.mffm.Main

Thanks!!!

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> If I using a ":" instead of ";" in classpath, the app is not started.
> If I using a ";" ,app is started normally and all libs is loaded:
>
> -Xbootclasspath/a=/lib/btclasses.zip
> -Xbootclasspath/a=/lib/personal.jar
> -Xbootclasspath/a=/lib/naming.zip
> -Xbootclasspath/a=/lib/jdbc1.zip
> -classpath "/Storage Card/lib/hsqldb.jar;/Storage Card/MFFMTechDemo.jar"
> com.pinsource.mffm.Main
>

Oops. Sorry, my mistake about using ":" instead of ";".

> and next config is work:
> -Xopt:useLargeMemoryArea=true
> -Xmx64m
> -Xms4m
> -Xbootclasspath/a=/lib/btclasses.zip
> -Xbootclasspath/a=/lib/personal.jar
> -Xbootclasspath/a=/lib/naming.zip
> -Xbootclasspath/a=/lib/jdbc1.zip
> -classpath "/Storage Card/lib/hsqldb.jar;/Storage Card/MFFMTechDemo.jar"
> com.pinsource.mffm.Main
>
> Thanks!!!
> [Message sent by forum member 'manenkov' (manenkov)

Great to hear you have it working now!
:-)

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

cjplummer
Offline
Joined: 2006-10-16
Points: 0

> Hello all!
>
> How I can set a available memory amount for CVM?
> (something like -xmx & -xms)?
>
-Xms (starting heap size), -Xmn (minimum heap size), and -Xmx (maximum heap size) are all supported.

> I using a hsqldb, and when I select a several
> thousands of rows, application crash (under Windows
> Mobile). I run this program on jre1.6 with settings
> -xms2m -xmx2m, and then I trying to select a several
> thousands of rows, I got a OutOfMemoryException.
>
> But handheld device has a 128mb of memory...Can I use
> all of this memory?
>
If you go with a heap bigger then a few MB, you should really use -Xopt:useLargeMemoryArea=true. This will allow the GC heap to be allocated outside of the 32mb per process Virtual Memory area.

Chris

manenkov
Offline
Joined: 2008-01-04
Points: 0

If I you the following .lnk, all is ok, application is starting (but have problems with memory):

250#\phoneme\personal\bin\cvm.exe -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.demo.mffm.Main"

But if I adding a -Xopt:useLargeMemoryArea=true in the path:

250#\phoneme\personal\bin\cvm.exe -Xopt:useLargeMemoryArea=true -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.pinsource.mffm.Main"

the link is not staring (nothing is happens).

The same way as, if I adding a -Xmx32m key to link:

250#\phoneme\personal\bin\cvm.exe -Xmx32m -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.pinsource.mffm.Main"

the link is not staring too (nothing is happens).

cjplummer
Offline
Joined: 2006-10-16
Points: 0

> 250#\phoneme\personal\bin\cvm.exe
> -Xopt:useLargeMemoryArea=true
> -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;
> \lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage
> Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar"
> "com.pinsource.mffm.Main"
>
This line is 251 characters, which may be the problem. Try putting arguments in a file, and then run with "-f ". This is the only way to handle a long list of arguments.

> the link is not staring (nothing is happens).
>
> The same way as, if I adding a -Xmx32m key to link:
>
> 250#\phoneme\personal\bin\cvm.exe -Xmx32m
> -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;
> \lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage
> Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar"
> "com.pinsource.mffm.Main"
>

-Xmx32m is too big unless you use -Xopt:useLargeMemoryArea=true.

> the link is not staring too (nothing is happens).

Chris

manenkov
Offline
Joined: 2008-01-04
Points: 0

I try to used a args file, and have some troubles.

I have a long lnk file:

250#\phoneme\personal\bin\cvm.exe -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.pinsource.mffm.Main"

All running fine.

I re-build this link as you said:

lnk file:

250#\phoneme\personal\bin\cvm.exe -f "\Storage Card\mffm.cfg"

mffm.cfg:
-Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.pinsource.mffm.Main"

When I run a lnk file, app is starting, but it seems like a jdbc is not loaded, maybe some others jars (ClassNotFound exception occurs).

If I add a -Xmx param in config file:

mffm.cfg:

-Xmx8m -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.pinsource.mffm.Main"

when app is starting, but ClassNotFound exception occurs.

If I add a -Xopt:useLargeMemoryArea=true param:

mffm.cfg:

-Xopt:useLargeMemoryArea=true -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.pinsource.mffm.Main"

When app is not staring (I click on lnk file, and nothing is happens).
It seems like a CVM is not recognized a Xopt:useLargeMemoryArea key....

cjplummer
Offline
Joined: 2006-10-16
Points: 0

I think your ClassNotFoundErrors are because on the bootclasspath you are just specifying "/lib" rather than "/Storage Card/lib".

For the useLargeMemoryArea option, I'm not sure what is wrong. Try intentionally putting a typo in there and see if an error message is reported. For example "-Xopt:xxxxuseLargeMemoryArea". If you do see an error message in this case, then cvm is recognizing the -Xopt:useLargeMemoryArea=true option properly. What device/OS are you running on and how much RAM does it have.

Chris

manenkov
Offline
Joined: 2008-01-04
Points: 0

No, a lib catalog is places on root, and, as I say, a lnk below is running ok:

250#\phoneme\personal\bin\cvm.exe -Xbootclasspath="\lib\btclasses.zip;\lib\personal.jar;\lib\naming.zip;\lib\jdbc1.zip" -classpath "\Storage Card\lib\hsqldb.jar;\Storage Card\MFFMTechDemo.jar" "com.pinsource.mffm.Main"

The ClassNotFound exception is exception, catching and showing in my app. My build a Phoneme (http://www.cs.kuleuven.ac.be/~davy/phoneme/dist/Personal_Profile-phoneme...)
han no any console for showing errors, and app just not started is ant errors presents (or abort without any message). So I can`t check the that is happens exaclty...

I trying it on WM emulator with 128mb RAM.

If you have a build of Phoneme with DEBUG option, can I get it? It will be very useful for me.

Thanks.

davyp
Offline
Joined: 2007-01-03
Points: 0

Have a look around for PocketConsole (freeware) and CMD if you want to
use a console on your WM2003 device. Although designed for WM2003,
PocketConsole also runs on WM2005, but on that device you have to mess
with the registry to enable stdout. Set the following key to 0:

HKEY_LOCAL_MACHINE\Drivers\Console\OutputTo

Davy

manenkov
Offline
Joined: 2008-01-04
Points: 0

Thanks, I install PocketConsole - it very useful thing! One question - can I force a output window to not hides after the program has finished execution?