Thread: Memory usage and memory leaks

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    7

    Angry Memory usage and memory leaks

    Mine is a very big with highly complex C program. I found the program crashes often while running. Even after giving fixes using core-dump analysis it was keep happening, I felt there may be memory releated issues.

    First I started to use 'top' command to see the memory usage of this program - keep increasing some time went upto 2Mb for every 15 minutes. But mostly around 150Kb for every 15 minutes and keep increasing for every 15 minutes. Memory used doesn't get reduced at all. I felt it as an indication of memory leak. Then I learnt 'valgrind' and gave fixes (almost 90% issues reported by valgrind).

    Now also the memory usage keeps increasing in the same manner as that before giving fixes to memory leaks. My team feels still there are memory leaks. How can I show them that there are no memory leaks (if there is not) or limited and is there relation exists between memory usage and memory leaks?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    http://valgrind.org/info/tools.html - say memcheck
    http://www.perens.com/works/software/ElectricFence/

    If your program is doing something like
    - read a file, allocate some memory
    - do work
    - write a file, free the memory
    Then yes, I'd expect it to level off at some point, perhaps increasing every so often in response to a new largest file seen so far scenario.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking for memory leaks
    By Bladactania in forum C Programming
    Replies: 5
    Last Post: 02-10-2009, 12:58 PM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  3. Dynamic Linking & Memory usage
    By @nthony in forum C Programming
    Replies: 2
    Last Post: 06-02-2007, 09:57 PM
  4. Deleting objects show no drop in memory usage.
    By theJ89 in forum C++ Programming
    Replies: 8
    Last Post: 04-02-2006, 06:21 AM
  5. Retrieving memory usage
    By Magos in forum Windows Programming
    Replies: 7
    Last Post: 01-29-2006, 11:25 AM