Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9059849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:04:30+00:00 2026-06-16T15:04:30+00:00

I am currently working on a large scale application project (written in c++) which

  • 0

I am currently working on a large scale application project (written in c++) which started from scratch some time ago, and we reached the point when it is mandatory to make a roundup of checks for memory leaks.

The application runs on an Ubuntu Linux, it has a lot of multimedia content, and uses OpenGl, SDL and ffmpeg for various purposes including 3D graph rendering, windows, audio and movie playback. You could think of it as a videogame, although it is not, but the duties of the application could be simplified by considering it a video game.

I am currently a little bit clueless in determining whether we still have memory leaks or not. In the past we had already identified some, and removed them. These days though, the application is nearly complete, and the tests we ran are giving me results which I cant exactly figure out.

First thing I did was to try to run the application through Valgrind… unfortunately then application crashes when running in a valgrind environment. The crash in “non-deterministic” since it crashes in various different places. So I gave up with Valgrind to easily identify the source of potential leaks, and ended up using two Linux commands: free and top.

free is being used for probing system memory usage while the application is running

top is being used with the ‘-p’ option, to probe the application process memory usage while running.

Output form top and free is being dumped into files for post-processing. I made up two graphs with the data which are linked at the bottom of the question.

The test case is very simple: data about memory is being probed once the application has already been launched and it is waiting for commands. Then I start a sequence of commands which repeatedly does always the same thing. The application is expected to load a whole lot multimedia data into RAM, and then download it.

Unfortunately the graph is not showing me what I was expecting. Memory usage grows through 3 different steps and then stops. Memory is apparently never released, which hinted me that there was a HUGE memory leak. that would be perfectly fine, since it would mean that very likely we were not freeing up memory eaten up by media stuff.

But after the first three steps… memory usage is stable… there arent any more huge steps… just slight up and down which correspond to the expected data loading and unloading. The unexpected here is that the data which is supposed to be loaded/unloaded makes up for hundredths of megabytes of RAM, instead the up and downs make of for just a handful of megabytes (lets say 8-10 MB).

I am currently pretty clueless in interpreting these data.

Anyone has some hints or suggestions? What am I missing? Is the method I am using for checking the presence of macroscopic memory leaks completely wrong? DO you know any other (preferably free) tool other than Valgrind for checking memory leaks?

System Memory Usage Graph

Process Memory Usage Graph

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:04:31+00:00Added an answer on June 16, 2026 at 3:04 pm

    First of all…

    and we reached the point when it is mandatory to make a roundup of checks for memory leaks.

    This, actually, is a problem of methodology. Correctness should be the primary goal of any software piece and not an afterthought.

    I will suppose though that you now realize this and how much easier it would have been to identify the problems had you been running an instrumented unit test at each commit.


    So, what to do now ?

    • Runtime detection:

      • Try to make Valgrind work, you probably have some environmental issues
      • Try ASan, ThreadSan and MemSan; they are not trivial to setup under Linux but oh so impressive!
      • Try instrumented builds: tcmalloc includes a heap-checker for example
      • …
    • Compile time detection:

      • Turn on the warnings (preferably with -Werror) (not specific to your issue)
      • Use static analysis, such as Clang’s, it may spot unpaired allocation routines
      • …
    • Human detection:

      • Code reviews: make sure all resources are allocated within RAII classes
      • …

    Note: using only RAII classes helps removing memory leaks, but does not help with dangling references. Thankfully, detecting dangling references is what ASan does.


    And once you have patched all the issues, make sure that this becomes part of the process. Changes should be reviewed and tested, always, so that rotten eggs are culled immediately rather than left to stink up the code base.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am working on a Large Scale Application which uses GWT with Hibenate.
Our team is currently working on a large project which makes heavy use of
I'm currently working on my first deployment of a large server side application which
I'm currently working on a fairly large project that has been migrated from Ant
I'm currently working on a project where we have a large data warehouse which
The project that I'm currently working on, is large scale. I'm using email activation
I am working on a large-scale checkout application for a current project. This checkout
I'm currently working on large C++ Qt based project which is a about to
I'm currently working on an application for uploading large video files from the iPhone
I'm currently working on a large project which is expected to have a large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.