Forum: JRuby Jruby virtual memory size

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nick Stielau (Guest)
on 2008-12-12 22:38
(Received via mailing list)
Hello,
  I have a question about memory usage with JRuby.  I am trying to get
JRuby (1.1.6RC1) to run in my GoDaddy virtual private server (Fedora
release 7 (Moonshine), with 256 guaranteed RAM).  Its not so much that
I need this to happen, but I want it, and I also feel that it is
important for JRuby to be able to run on a wide range of platforms.
When I try to run it, I get this error message

<<<
[nick@hungryfella ~]$ /opt/jruby-1.1.6RC1/bin/jruby -J-Xmn1m -J-Xms2m -
J-Xmx2m -e "puts 'hello world'"
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
 >>>

Since that wasn't working, I tried to examine the memory usage on my
macbook.  I ran this:

<<<
nick-stielaus-computer-2:~ nick$ jruby -J-Xmn1m -J-Xms2m -J-Xmx2m
Warning: could not find JRE in /usr, using /System/Library/Frameworks/
JavaVM.framework/Versions/1.6.0/Home as JRE home.
 >>>

and then looked at the output with "ps aux | grep jruby -B2"

<<<
nick     66901   0.0  1.0   335812  30900   ??  S    Tue07PM
0:37.91 /Applications/TextMate.app/Contents/MacOS/TextMate -psn_0_548998
nick     16070   0.0  0.9  2874800  29308 s010  S+    3:12PM
0:00.81 /usr/bin/java  -client -Djruby.memory.max=2m -
Djruby.stack.max=1024k -Xmx2m -Xss1024k -Djna.boot.library.path=/opt/
jruby/lib/native/darwin -Xmn1m -Xms2m -Xbootclasspath/a:/opt/jruby/lib/
jruby.jar -classpath /opt/jruby/lib/bsf.jar:/opt/jruby/lib/jruby.jar:/
opt/jruby/lib/profile.jar: -Djruby.home=/opt/jruby -Djruby.lib=/opt/
jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh
 >>>

My guess is that on the GoDaddy VPS jruby/java tries to use a ton of
virtual memory, even though that memory is not actually all accessible
to my VPS.

My questions are 1) Why does it appear that jruby is using 2.8 gigs of
virtual memory?  2) why is jruby using 29 megs of memory when I set
the -Xmx flag to 2 megs?  3) is there any way that I can limit the
virtual memory usage (ulimit ?) ?

Thanks for your help.

-nick

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Gabe Wong (Guest)
on 2008-12-12 23:04
(Received via mailing list)
Nick Stielau wrote:
> -J-Xmx2m -e "puts 'hello world'"
> Error occurred during initialization of VM
> Could not reserve enough space for object heap
> Could not create the Java virtual machine.

That is not an issue with JRuby. That is the nature of JAVA. I do not
know how many java programs can possibly
run with such low memory parameters. Just not possible. Try at least
Xmx64M.
Remember You need memory to load the JRuby libraries in addition to the
core JAVA stack.

Regards

> >>>
> /opt/jruby/lib/bsf.jar:/opt/jruby/lib/jruby.jar:/opt/jruby/lib/profile.jar:
> the -Xmx flag to 2 megs?  3) is there any way that I can limit the
>
>
>


--
Regards

Gabe Wong
cloudAPPy
the Drag-and-drop Hosting CLOUD
http://www.cloudappy.com


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Nick Stielau (Guest)
on 2008-12-13 00:36
(Received via mailing list)
Thanks for your reply, Gabe.

I just used the low memory value to demonstrate the issue. This
command ' /opt/jruby-1.1.6RC1/bin/jruby -J-Xmn1m -J-Xms2m -J-Xmx2m -e
"puts 'hello world'" ' WILL run on my mac, but it WILL NOT run on the
VPS.    I realized I can't even run Java, so this is really a Godaddy
VPS issue.  I submitted a ticket to godaddy to see what they have to
say.

Thanks,
-nick

On Dec 12, 2008, at 1:03 PM|Dec 12, 2008, Gabe Wong wrote:

>> [nick@hungryfella ~]$ /opt/jruby-1.1.6RC1/bin/jruby -J-Xmn1m -J-
> the core JAVA stack.
>> Warning: could not find JRE in /usr, using /System/Library/
>> 0:00.81 /usr/bin/java  -client -Djruby.memory.max=2m -
>>
>> To unsubscribe from this list, please visit:
> Gabe Wong
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Nick Stielau (Guest)
on 2008-12-13 00:50
(Received via mailing list)
It found the answer here:
http://www.colinmcnamara.com/2008/02/03/why-godadd...
I guess godaddy auto-installs a tomcat based control panel for the
virtual servers, which makes 'a mess of the server'. Stopping that, I
can run jruby.  Long live jruby!


On Dec 12, 2008, at 2:36 PM|Dec 12, 2008, Nick Stielau wrote:

> -nick
>>> of platforms.  When I try to run it, I get this error message
>> run with such low memory parameters. Just not possible. Try at
>>>
>>> 0:37.91 /Applications/TextMate.app/Contents/MacOS/TextMate -
>>> My guess is that on the GoDaddy VPS jruby/java tries to use a ton
>>> -nick
>> --
>>
>>  http://xircles.codehaus.org/manage_email
>>
>>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.