Bug 129576 - Massif loses track of memory, incorrect graphs
Summary: Massif loses track of memory, incorrect graphs
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: massif (show other bugs)
Version: 3.1.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Nicholas Nethercote
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-21 15:44 UTC by Axel Liljencrantz
Modified: 2007-11-26 23:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Axel Liljencrantz 2006-06-21 15:44:43 UTC
Version:           3.1.0 (using KDE KDE 3.5.3)
Installed from:    Fedora RPMs
Compiler:          GCC 4.1 
OS:                Linux

Massif loses track of the memory allocated by a program, and then occasionally rediscovers it, resulting in a huge underestimation of the amount of memory used. 

The effect can be seen in the graphs, produced by starting fish with the following commandline and exiting at once by pressing Ctrl-d

valgrind --tool=massif --alloc-fn=wcsdup --alloc-fn=env_set --alloc-fn=halloc --alloc-fn=hash_realloc --alloc-fn=str2wcs  ./fish

http://roo.no-ip.org/massif.8999.ps
http://roo.no-ip.org/massif.8999.txt

After 1.5 seconds, the memory use drops from 80 kB to almost 20 kB. During the course of half a second, the lost memory is rediscovered and lost again three times. After that, the memory usage slowly increases back to 50 kB. What actually happens is that after 1.5 seconds, some memory, mostly the parts used by the reader_read function is deallocated. But not nearly so much as the graph would lead you to belive is free'd. E.g. the memory used by env_init is not free'd until shutdown.

By not using --alloc-fn, the problem is made smaller, but it still exists. See 

http://roo.no-ip.org/massif.9693.txt
http://roo.no-ip.org/massif.9693.ps

which where procuded using 

valgrind --tool=massif ./fish

Memory is still lost occasionally, but it is always rediscovered again after a short time.

The program in question is fish, a commandline shell, available for download under the GPL at http://roo.no-ip.org/fish/. All recent fish versions exhibit this behaviour, at least under Fedora Core 4 and Fedora Core 5.
Comment 1 Nicholas Nethercote 2007-11-26 23:36:23 UTC
[A general message:]

Massif has recently been completely overhauled.  Instead of recording
space-time usage, it now records space usage at various points during 
execution, including the peak allocation point.  The output format has also
changed, and presents more information, more compactly.  It's also more
robust than the old version.

The new version will be Valgrind 3.3.0, which should be released in the next
week or two.  In the meantime, if you want to try it, please check out the 
code from the SVN repository (see
http://www.valgrind.org/downloads/repository.html for how).

[A specific message about this bug:]
I'm closing this bug, as the new version should have fixed the problem.  Please reopen if it still happens.