Output of ps and gtop differ. Surprising gtop behaviour.

I am developing EtherApe,  which is a network monitor application.
Being a monitor which also provides some nice eye candy, a lot of people
run it continuously on their machines, and so I have to be very careful
about memory leaks.

Using gtop and several stress tests I was pretty sure there were no
more leaks, but recently I've realized that there are strange things going on:

Surprise 1
-- ps and Gtop output differ. For the same progam instance, I have

           Size   Rss    Resident  Share
           ----   ----   --------  -----
    PS     9360   3524
    GTOP   4104   3524   3528      1928

Surprise 2
-- For a fresh started etherape process, gtop reports 
   5356 for size, rss and resident; and 3896 for shared.
   Then, after some time the numbers magically come down almost
   a couple of megabytes.

Can somebody explain to me what is going on? If I understand correctly
the size field should report all virtual memory that has been allocated
to a process (which is what I want to track to make sure I am not leaking)
and there should be no way by which the program reduces the initial usage.

And why is there such a difference with the vss reported by ps? Which 
program should I trust?

Somebody please enlighten me.


EtherApe, a graphical network monitor modeled after etherman

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]