473,382 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

memory usage on linux

hi,

i have a java application that can be fairly memory intensive. so, when i
run the program, i use the -Xmx option to prevent out of memory errors.
in particular, i have been using -Xmx512m, which should be enough for my
needs... but the out of memory errors continue.

so, i tried to observe this in action.

i ran top while my program was executing, and sorted by memory usage. as
expected on linux, all the java threads show up as processes. now, top
reports the rss on each thread to be around 75MB when the application hits
the error... and about 7-8 threads when this occurs. now i know that the
-Xmx option is for java objects only, and doesn't pertain to the virtual
machine's own memory requirements... but this observation seems to
indicate that each thread actually is consuming its own 75MB of memory.
this is also supported with each java thread only consuming about 4K of
shared memory, as reported by "top".

is what i think i'm observing actually happening? is each java thread
actually consuming that much extra memory (i.e. without sharing it all
through the single java virtual machine heap)? somehow, i doubt it... but
the out of memory errors seem to be happening well before 512MB of java
object information is created.

note, too, that i am not actually creating these seperate threads... my
app is single-threaded... the 7-8 are those threads executed intially by
the java virtual machine.

thanks for any insight on this matter... or even a link to a good source
that describes this.

thanks much again,

murat

--
Murat Tasan
mx**@po.cwru.edu
ta***@eecs.cwru.edu
mu*********@cwru.edu
http://genomics.cwru.edu

Jul 17 '05 #1
1 7389
well, i found the problem. the program does indeed use over 512MB of heap
space.

the interesting part though, is for linux users. the "top" program seemed
to give faulty output when run without being modified interactively. that
is... in situation 1, i ran top, hit "M" to sort by memory, and watched
(using the default refresh rate, which is something like 3-5 seconds on my
box). it started to stall and not update correctly... i only caught it by
running situation 2, where i ran top, hit "M" to sort by memory, then "s"
and gave a refresh of 1 second. suddenly the values changed drastically
and the memory usage climbed quite high.

this must be a bug in top, because the java virtual machine doesn't grow
that quickly in a second. i've verified this again by running top again
and setting the refresh rate to 1 second before executing the java app.

so, as a note... when examining memory or cpu usage through top, make sure
you manually set the rate through the "s" key.

of course, this may only be a bug on a few systems.

sorry about that,

murat

On Tue, 16 Mar 2004, Murat Tasan wrote:
hi,

i have a java application that can be fairly memory intensive. so, when i
run the program, i use the -Xmx option to prevent out of memory errors.
in particular, i have been using -Xmx512m, which should be enough for my
needs... but the out of memory errors continue.

so, i tried to observe this in action.

i ran top while my program was executing, and sorted by memory usage. as
expected on linux, all the java threads show up as processes. now, top
reports the rss on each thread to be around 75MB when the application hits
the error... and about 7-8 threads when this occurs. now i know that the
-Xmx option is for java objects only, and doesn't pertain to the virtual
machine's own memory requirements... but this observation seems to
indicate that each thread actually is consuming its own 75MB of memory.
this is also supported with each java thread only consuming about 4K of
shared memory, as reported by "top".

is what i think i'm observing actually happening? is each java thread
actually consuming that much extra memory (i.e. without sharing it all
through the single java virtual machine heap)? somehow, i doubt it... but
the out of memory errors seem to be happening well before 512MB of java
object information is created.

note, too, that i am not actually creating these seperate threads... my
app is single-threaded... the 7-8 are those threads executed intially by
the java virtual machine.

thanks for any insight on this matter... or even a link to a good source
that describes this.

thanks much again,

murat


--
Murat Tasan
mx**@po.cwru.edu
ta***@eecs.cwru.edu
mu*********@cwru.edu
http://genomics.cwru.edu

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ian | last post by:
Hi all, I have a problem. I have an application which needs to work with a lot of data, but not all at the same time. It is arranged as a set of objects, each with lots of data that is created...
5
by: Eddie | last post by:
I have a MySQL-server running Innodb. We have installed ~ 2GB of memory in the server. In spite of this MySQL keeps crashing due to out-of-memory errors. The server is a dual xeon i686 running...
6
by: hauger | last post by:
(DB2 V.8.1) Hi @ll, when i start my DB2 and my application connects and makes some SQL Tests my system is running out of memory (UNITED LINUX 1.0) goes slow and needs very very long time to...
35
by: Alex Martelli | last post by:
Having fixed a memory leak (not the leak of a Python reference, some other stuff I wasn't properly freeing in certain cases) in a C-coded extension I maintain, I need a way to test that the leak is...
4
by: Hermann Maier | last post by:
hi, i need to find out the memory usage of a specific function that i use in my program. this function does some recursive calculations and i want my program to display the amount of memory the...
9
by: jeungster | last post by:
Hello, I'm trying to track down a memory issue with a C++ application that I'm working on: In a nutshell, the resident memory usage of my program continues to grow as the program runs. It...
17
by: frederic.pica | last post by:
Greets, I've some troubles getting my memory freed by python, how can I force it to release the memory ? I've tried del and gc.collect() with no success. Here is a code sample, parsing an XML...
2
by: thomasolsen | last post by:
Hi, I have a java program running on Linux Debian using jre 1.6 (I have tried under 1.5 with excatly the same results). As the program is running as a service I have been watching the memory usage...
13
by: Ilias Lazaridis | last post by:
How to detect memory leaks of python programms, which run in an environment like this: * Suse Linux 9.3 * Apache * mod_python The problem occoured after some updates on the infrastructure....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.