473,806 Members | 2,321 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get statistics about memory usage ?

Hi,

Inside a program, I need to get some statistics about memory usage.
I actually need figures given by the "ps -o vsr,rss" command.

For the moment, I make a popen("ps...") followed of a scanf on what it
displays. It is a little complicated, and that distorts measurements.
Is there a better way?

I have tried "getrusage( )". However values returned are not really
relevant for my needs.

I also looked at "mallinfo() ", without success.
First, I do not know what is that a "block" (which size ?). Then, that does
not count the stack size and the code size, just the malloc.
(By the way, it's more or less a C++ code. So, are the "new" counted in
mallinfo() ?)

Then, how can my program know its "resident set size" and especially its
"virtual memory size"?

Thanks.
Christophe
Dec 2 '05
26 19146
On 2005-12-02, Joe Estock <je*****@NOSPAM nutextonline.co m> wrote:
Kenny McCormack wrote:
[usual crap]

You're still alive Kenny? I thought someone would have killfiled you by now.


You know - i don't think you understand how a "killfile" works. It
blocks him from being seen by the person who sets the killfile entry,
unless someone else [you] responds to him. If you want him gone, _you_
have to "killfile" him [i'm not sure how thunderbird 1.0.9 does it, but
surely there's some way to ignore or mark-as-read based on from address]
Dec 2 '05 #11
"Mark B" <so***@localbar .com> writes:
"Flash Gordon" <sp**@flash-gordon.me.uk> wrote in message
news:dk******** ****@news.flash-gordon.me.uk...
Kenny McCormack wrote:
In article <ln************ @nuthaus.mib.or g>,
Keith Thompson <ks***@mib.or g> wrote:
"David Resnick" <ln********@gma il.com> writes:
[...]
> This is all system specific, so OT in comp.lang.c. From what you are
> saying,
> I believe comp.unix.progr ammer would be a good place for you to get
> help. <OT> On Linux, May find what you want in /proc file system, you
> could ask about that in cup </OT>
<STILL_OT>
/proc is Linux-specific, though some other Unix-like systems may
provide something similar.
</STILL_OT>

That should have been:

<WRONG>
/proc is Linux-specific, though some other Unix-like systems may
provide something similar.
</WRONG>


No, what Keith said is correct.


Actually, what Keith said is most definately NOT correct.
Solaris has /proc, as do (I believe) over Unix flavors.


Are you claiming that these Unix flavours are not like Unix?


No, his claim is that: /proc is NOT linux specific... and he is right.
Many systems (which predate Linux) also use(d) a /proc file system.


Sigh.

My wording was slightly sloppy. The existence of /proc is not
Linux-specific. The details of the interface of /proc *are*, as far
as I know, Linux-specific (and/or specific to the system in question).
My intent was merely to suggest that cup (comp.unix.prog rammer) is not
the best place to discuss /proc, since it covers systems with widely
varying /proc interfaces (or none at all, at least for some older
systems). The details of /proc would be topical in one of the
comp.os.linux.* groups, or in comp.unix.solar is, or comp.unix.aix, or
whatever.

This is tangentially topical here only insofar as we're trying to
determine the best newsgroup to which to redirect the original poster
(who is probably long gone by now).

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 2 '05 #12
Joe Estock <je*****@NOSPAM nutextonline.co m> writes:
Kenny McCormack wrote:
[usual crap]

You're still alive Kenny? I thought someone would have killfiled you by now.


Oh no! They killed Kenny!

--

John Devereux
Dec 2 '05 #13
In article <vY2kf.595437$_ o.124251@attbi_ s71>,
Joe Estock <je*****@NOSPAM nutextonline.co m> wrote:
Kenny McCormack wrote:
[usual crap]

You're still alive Kenny? I thought someone would have killfiled you by now.

Joe


Like a bad penny...

Dec 3 '05 #14
On Fri, 02 Dec 2005 20:17:37 +0000, in comp.lang.c , Flash Gordon
<sp**@flash-gordon.me.uk> wrote:
Solaris has /proc, as do (I believe) over Unix flavors.

Howevr what solaris puts in /proc is rather different.
Are you claiming that these Unix flavours are not like Unix?


I think keith's point was that the contents of /proc are
operating-system specific.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Dec 3 '05 #15
In article <or************ *************** *****@4ax.com>,
Mark McIntyre <ma**********@s pamcop.net> wrote:
On Fri, 02 Dec 2005 20:17:37 +0000, in comp.lang.c , Flash Gordon
<sp**@flash-gordon.me.uk> wrote:
Solaris has /proc, as do (I believe) over Unix flavors.


Howevr what solaris puts in /proc is rather different.
Are you claiming that these Unix flavours are not like Unix?


I think keith's point was that the contents of /proc are
operating-system specific.


Which is the same as saying that trees are North-America-specific, because
our trees are different from the trees that grow in other parts of the
world.

Note that, ordinarily, I'd cut him some slack - it's late, his phrasing was
inexact - but this is clc where what we do is stomp on people for any
possible error, no matter how microscopic. That's the game we play here,
and I like it!

Dec 3 '05 #16
Mark McIntyre <ma**********@s pamcop.net> writes:
On Fri, 02 Dec 2005 20:17:37 +0000, in comp.lang.c , Flash Gordon
<sp**@flash-gordon.me.uk> wrote:
Solaris has /proc, as do (I believe) over Unix flavors.
Howevr what solaris puts in /proc is rather different. Are you claiming that these Unix flavours are not like Unix?

I think keith's point was that the contents of /proc are
operating-system specific.

It's very interesting to note that the first reply to this topic was
someone quickly highlighting how off-topic the topic was. The OP has
since moved on to comp.unix.progr ammer, and received a helpful reply.

Since then, we've seen about a dozen articles, some from old hands,
continuing a debate about exactly what is, and what is not, a
Linux-specific feature.

Just an observation....

--
Chris.
Dec 3 '05 #17
Chris McDonald wrote:

Mark McIntyre <ma**********@s pamcop.net> writes:
On Fri, 02 Dec 2005 20:17:37 +0000, in comp.lang.c , Flash Gordon
<sp**@flash-gordon.me.uk> wrote:

Solaris has /proc, as do (I believe) over Unix flavors.
Howevr what solaris puts in /proc is rather different.

Are you claiming that these Unix flavours are not like Unix?

I think keith's point was that the contents of /proc are
operating-system specific.


It's very interesting to note that the first reply to this topic was
someone quickly highlighting how off-topic the topic was. The OP has
since moved on to comp.unix.progr ammer, and received a helpful reply.

Since then, we've seen about a dozen articles, some from old hands,
continuing a debate about exactly what is, and what is not, a
Linux-specific feature.

Just an observation....


I was thinking the same thing.

"The off topic argument"

--
pete
Dec 3 '05 #18
In article <dm**********@e nyo.uwa.edu.au> ,
Chris McDonald <ch***@csse.uwa .edu.au> wrote:
Mark McIntyre <ma**********@s pamcop.net> writes:
On Fri, 02 Dec 2005 20:17:37 +0000, in comp.lang.c , Flash Gordon
<sp**@flash-gordon.me.uk> wrote:
Solaris has /proc, as do (I believe) over Unix flavors.
Howevr what solaris puts in /proc is rather different.

Are you claiming that these Unix flavours are not like Unix?

I think keith's point was that the contents of /proc are
operating-system specific.

It's very interesting to note that the first reply to this topic was
someone quickly highlighting how off-topic the topic was. The OP has
since moved on to comp.unix.progr ammer, and received a helpful reply.

Since then, we've seen about a dozen articles, some from old hands,
continuing a debate about exactly what is, and what is not, a
Linux-specific feature.


It's what we do. We're not allowed to talk about anything substantive, so
this is what we do.
Just an observation....


And a good one.

Dec 3 '05 #19
Jordan Abel wrote:
On 2005-12-02, Joe Estock <je*****@NOSPAM nutextonline.co m> wrote:
Kenny McCormack wrote:
[usual crap]

You're still alive Kenny? I thought someone would have killfiled you by now.

You know - i don't think you understand how a "killfile" works. It
blocks him from being seen by the person who sets the killfile entry,
unless someone else [you] responds to him. If you want him gone, _you_
have to "killfile" him [i'm not sure how thunderbird 1.0.9 does it, but
surely there's some way to ignore or mark-as-read based on from address]


Thanks for the clarification Jordan. I was under the presumption that a
killfile was controlled server side not client side.

Joe
Dec 3 '05 #20

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

Similar topics

4
2501
by: Anand Pillai | last post by:
Hi Folks (posting after a loooong time...) I have been contracted by an Indian publisher to author an introductory text book on Python. As a part of the introductory chapter, I thought it would be a good idea to present a number, a round-about figure on the approximate *actual* usage of Python out there in number of developers and/or installations.
3
4155
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database periodically. What happens, is that the app reads the contents of a text file line by line into an ArrayList. Each element of the ArrayList is a string representing a record from the file. The ArrayList is then processed, and the arraylist goes out of...
1
2428
by: Jason | last post by:
Greetings, Is there a reliable and portable way of getting malloc statistics within a running C program? I have tried to use the mallinfo() command, but it isn't portable (reports different things on linux and HP), and Purify reports memory access violations with it. At any given point in a program, I would like to grab total used memory for the process. Does anyone have a good way of doing this? Thanks Jason
4
3563
by: serge | last post by:
I am running a query in SQL 2000 SP4, Windows 2000 Server that is not being shared with any other users or any sql connections users. The db involves a lot of tables, JOINs, LEFT JOINs, UNIONS etc... Ok it's not a pretty code and my job is to make it better. But for now one thing I would like to understand with your help is why the same SP on the same server and everything the same without me changing anything at all in terms of SQL...
17
5108
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also identifying memory leaks. The application in question is the Mozilla Web Browser. I also have had similar tasks before in the compiler construction area. And it is easy to come up with many more examples, where such kind of statistics can be very...
5
1747
by: Allan Ebdrup | last post by:
Hi We have a large class library of different classes, now we are going to implement a lot of usage statistics that we need, stuff like how many times a user has logged in, how many times a message has been read, how many times a ad has been shown and so on. Now I'm wondering what would be a good OO organization of this data, should the statistics be part of the objects they are for, or should statistics be seperate. Perhaps each object...
2
2681
by: Quasar | last post by:
Hi everybody! I''ve created a script that enable the statistics for a specific DB: #!/bin/sh if ; then echo Enabling monitoring switches for ${1} db2 connect to ${1} db2 update monitor switches using TABLE on UOW on TIMESTAMP on STATEMENT on BUFFERPOOL on LOCK on SORT on
1
2051
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after the objects for which that memory was allocated are no longer live in the process. This is only a leak if peak memory goes up again each time you create any new objects. Try repeated allocations of a large dictionary and observe how memory...
10
6544
by: w.l.fischer | last post by:
Is it possible to have statistics on temporary tables? I frequently put 10000 or more rows in a temporary table and would like to know it the queries become faster with statistics on those tables.
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10618
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10371
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.