Results 1 to 3 of 3
  1. #1

    Member Since
    Dec 21, 2007
    Question on calculating memory used in a program
    My question is why my calculation on memory usage is much different from the VSIZE shown in "top" command?

    I calculated memory usage of my c program, compiling with gcc-4.0.1 on a MacPro. The funny thing is that my calculation shows about 40MB maximum memory usage, but the largest VSIZE in "top" command for this program is about 300MB. I double-checked my calculation and was sure that it is correct. My friend told me that it might be due to gcc's memory management strategy, which might not collect garbage as long as there is memory available. It might be true, since I dynamically allocate and release a lot of memory.

    Can anybody give me more suggestions? Thanks!!!

  2. #2

    Member Since
    Dec 24, 2006
    N. Ireland
    Mac Pro 2xQuad core 2.8GHZ
    Maybe you have a memory leak or two in your code?

  3. #3

    Member Since
    Nov 20, 2007
    Dublin, Ireland
    From the manpage for top:
    VSIZE(delta) Total address space allocated, including shared pages.
    RSIZE(delta) Total resident memory size, including shared pages.
    I think you're looking for RSIZE

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. battery calculating - normal...
    By bobbyz in forum Apple Notebooks
    Replies: 2
    Last Post: 10-16-2010, 09:09 AM
  2. Program that showed memory usage
    By battleflag in forum Apple Notebooks
    Replies: 2
    Last Post: 06-14-2009, 04:36 PM
  3. calculating All Sizes - Finder
    By shahvikram123 in forum macOS - Operating System
    Replies: 0
    Last Post: 07-07-2008, 06:48 AM
  4. Calculating??
    By chriskierig in forum Apple Notebooks
    Replies: 3
    Last Post: 10-28-2004, 05:22 PM
  5. OSX Program Memory Allocation
    By gsx292 in forum macOS - Operating System
    Replies: 3
    Last Post: 02-09-2004, 01:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts