[SOLVED] Memory leak

What exactly IS a ‘Memory leak’ !

An application is said to “leak memory” when it requests memory address space from the operating system, but when it’s finished using the memory it doesn’t release it back to the OS for reallocation … the application may then request more memory but the OS can only give it unallocated memory space so it gives it new addresses, which in turn aren’t handed back to the OS … so the application keeps eating more and more memory.

In a worst case scenario, ALL memory address space will eventually be allocated, your system runs out of RAM and starts using the swap file/partition (which is MUCH slower than RAM so your system will slow considerably) … when the swap file/partition is also all being used your system will crash (in reality it will probably crash before that point, but you get the idea).


This may explain it better than I:

Is there any way I can force a release of memory?

I doubt it (at least not easily, and without knowing which addresses to flush) … killing the errant application might work … where is this all coming from ?

I’m running Banshee, EasyTag and MusicBrainz and the screen ‘greys out’ and it goes really slow at times…

At startup I’ve got;
HP System Tray Service
NVidia Xserver Settings

Don’t know what system programs are run at startup

To get an indication of whether an application is leaking memory …

Fire up the suspect application(s) …

Then run:


When top starts hit Shift+M

top will now display which applications/processes are using the most memory (%MEM column) … then just leave them running and see if any of them appear to keep using more and more memory for no apparent reason … be aware it may be a slow creeping climb in memory usage, so leave top open.

cheers for that, it’s a usefull tool.
Banshee looks like a VERY memory hungry program

Not really, it’s only using 5.5% of your memory … it IS however using nearly ALL your CPU’s processing power :o

in your screenshot top is displaying the top CPU using apps/processes

to switch top to displaying the top memory using apps/processes, you need to hit Shift+M … to switch back to RAM, Shift+P

I’m not convinced this is a memory leak … more likely Banshee is topping out your CPU

re Banshee, I miss-read the column, however, I used musicbrains (Picard) and it used a lot too.
Maybe I need to upgrade to more ram, maybee upgrade the processor, I am looking to get a Phenom III.

Your load averages are through the roof ???

I’m off to bed now, but at some point … reboot … then without opening any applications, open a terminal and run:


Now leave the PC doing nothing for about 15 mins, then take a screenshot of top and post it here.

When it’s finished, I’ll do a reboot with the startup programs selected and then without the startup programs selected and post the relevant screenshotsw.

Each process is allocated its own memory pool from which it draws memory. Killing a process will release the entire pool, this is the only way, you can’t release bits from outside the program.

Caveat: on occasion its possible to cause a device driver to leak … this generally requires a reboot to fix … but this instance would qualify as a kernel bug.

If you want to see if your program is leaky, check out “valgrind” …

Sent from my Nexus S using Tapatalk 2

I did look at some programs in the Ubuntu Software Centre and saw a reference to valgrind, I will have another look in a bit.

First screenshot is with the previously mentioned programs in startup and the second is without .

They’re OK … so you must have been doing something that was seriously CPU intensive previously.

Does VLC use as much RAM/CPU whilst playing music ?

Here’s another screenshot of top;
I dont use VLC much so wouldn’t know.

As said earlier, I am using Banshee and have seen that it is downloading info and media art on the songs, MusicBrainz uses a lot too. Krusader seems to hang if left alone for a while too.

I have solved the problem by removing MusicBrainz Picard as I have found that EasyTAG can do the same and more, so it is MUCH better and it does NOT eat up all my RAM when saving metadata.