• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reduce JRE memory usage.

 
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..

I'm using JRE 1.6 with update 13. I'm running it under redhat based environment. I'm running following program.



My ps command shows following output.

1744 root 203m S /bin/jre6/bin/java Test



See its eating 203MB..

can anyone suggest me how I can reduce this ?

Thanks in advance.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's most likely the virtual space being allocated, not physical.
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:That's most likely the virtual space being allocated, not physical.



are you talking about page files ? If yes then I want to reduce that page file usage also..
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'd probably have to do something Linux-y, then; the best you could do with Java proper is use -Xms/-Xmx/etc.

What makes you think you need to do this?
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:You'd probably have to do something Linux-y, then; the best you could do with Java proper is use -Xms/-Xmx/etc.

What makes you think you need to do this?



I've also tried to start java with -Xms64M -Xmx64M parameters. But unfortunately it was showing the same amount of memory.

I've very low memory device (256 MB RAM and 256MB Flash Drive). As you can see java is eating up around 50% of memory.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're running a standard JVM on an embedded system you're asking for trouble--I can almost guarantee you that you don't want to do that. Depending on the platform there are a number of alternatives available.
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:If you're running a standard JVM on an embedded system you're asking for trouble--I can almost guarantee you that you don't want to do that. Depending on the platform there are a number of alternatives available.



Great.. If you can suggest me an alternative please ?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No; I know next-to-nothing about your platform and requirements--why not just search the web?
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:No; I know next-to-nothing about your platform and requirements--why not just search the web?



I did that too.. I've tried many VM named sablevm, tinyvm, apache harmoney, jamvm and kaffe etc. If you can suggest any alternative please ?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I still don't know anything about your requirements, technical or otherwise, why you rejected any of the VMs you listed, whether or not you're only considering free VMs, what CPU you're using, why you're considering Java if it doesn't meet your requirements, basically anything that would enable me to make any reasonable suggestions, so the answer is still no. Someone else might be able to help, though.
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:I still don't know anything about your requirements, technical or otherwise, why you rejected any of the VMs you listed, whether or not you're only considering free VMs, what CPU you're using, why you're considering Java if it doesn't meet your requirements, basically anything that would enable me to make any reasonable suggestions, so the answer is still no. Someone else might be able to help, though.



I'm using custom compiled linux. So some of these vm didn't work on it. And some worked but they've not performed well so I've rejected them. BTW Thanks for the reply and suggestion.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not an embedded system - it's a server computer, but it's probably a very old one. Unless we switched machines and OS's somewhere in the thread and I missed it.

256MB of RAM is a real problem these days. To run any recent version of the RedHat distros with X you'll need over 100MB RAM for the OS and GUI desktop alone, even before you start Java. And Java's core VM requirements are not insignificant. The "-X" JVM parameters refer to its working storage, not the fixed overhead like the core classes.

You can reduce the OS memory overhead somewhat by not running X. On the other hand, if you intend to run a Tomcat server, you probably need a minimum of 256MB just for Tomcat. And don't even think of trying to do software development with a modern GUI IDE on it. My main development machine has 1.5GB RAM and still runs short.

Also, if this is one of the older Red Hat releases, I don't guarantee that the Sun JVM will run on it, much less any of the custom embedded JVM's. Which often get their small footprint by discarding functionality.
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah you are right. But as I said I've custom compiled linux. I don't have a X server installed on it. I've only console based linux and I'm using some light weight applications like busybox etc.. So if you can suggest any open source custom embedded VM. Its okay I will accept some discards of functionality.

Thanks.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

if you intend to run a Tomcat server, you probably need a minimum of 256MB



?? My Tomcat 5.5.9 server runs in the minimum 64mb, or 128 if I am feeling generous, and that is with a lot of object creation.

Bill
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:

if you intend to run a Tomcat server, you probably need a minimum of 256MB



?? My Tomcat 5.5.9 server runs in the minimum 64mb, or 128 if I am feeling generous, and that is with a lot of object creation.

Bill



Okay Mr. william can you tell me how to run it in 64MB RAM without eating much page memory ?
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dhaval yoganandi wrote:
are you talking about page files ? If yes then I want to reduce that page file usage also..



This is not about page file (a.k.a. swap). Virtual memory includes everything in process address space which includes memory mapped files, unused space, shared memory, IO memory, etc.

My "virteater" program eats 1TB of memory. That memory is purely virtual, it is never actually used and it is not backed by any physical space in RAM or disk. (I don't really have that much space.)


 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright so do you have any alternative light weight JVM ?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe, you should try static compilation? E.g. gcj, or (which I prefer) Excelsior JET.
 
dhaval yoganandi
Ranch Hand
Posts: 35
Android VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andy McBee wrote:Maybe, you should try static compilation? E.g. gcj, or (which I prefer) Excelsior JET.



yes.. I'm using ecj for compilation.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dhaval yoganandi wrote:

Andy McBee wrote:Maybe, you should try static compilation? E.g. gcj, or (which I prefer) Excelsior JET.



yes.. I'm using ecj for compilation.


It seems to me that you are mistaking ecj for gcj. The former is the Eclipse Java source to bytecode compiler, whereas gcj can also produce a native executable that runs directly on the CPU, and so can Excelsior JET.

Specifically Tomcat users may wish to wait for Excelsior JET 7.0, currently in beta
reply
    Bookmark Topic Watch Topic
  • New Topic