Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Hi Friends,

Could you please suggest a free Memory Profiler Tool for C++(Visualstudio2005).
Note : I would like to be able to see Memory Usage Graph..

Regards
Narayana Reddy.L
Posted
Updated 10-Jul-12 2:56am
v2
Comments
pasztorpisti 10-Jul-12 18:49pm    
This info might not be enough for ppl to give suggestions. Maybe giving some more info about your case will help.
What do you want to profile exactly? Total allocated memory? Fragmentation? Number of allocations? Distribution of the size of allocated/deallocated chunks? Catch the unallocated chunks at exit? Find out which module leaks and where? Do you use custom memory management? ...
Lakkan 13-Jul-12 0:40am    
Thank you for your response..
My requirement is very simple : show memork leaks in the form of graph(memory versus time). [Requires free tool].

Here you could find some tools that you could use for your work:

(1) Valgrind ( http://www.valgrind.org/ ) is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools.The Valgrind distribution currently includes six production-quality tools: a memory error detector,two thread error detectors, a cache and branch-prediction profiler, a call-graph generating cache and branch-prediction profiler, and a heap profiler. It also includes three experimental tools: a heap/stack/global array overrun detector, a second heap profiler that examines how heap blocks are used, and a SimPoint basic block vector generator.

(2)Memcheck a memory error detector
(http://valgrind.org/docs/manual/mc-manual.html)

(3)Try the goole-perftools ( http://code.google.com/p/gperftools/?redir=1 )
Heap profiling is included in TCMalloc, and I believe it is possible to "reset"
heap usage just before your "certain stage", and query the heap state right after

Google's framework for writing C++ tests (http://code.google.com/p/googletest/)on a variety of platforms (Linux, Mac OS X, Windows, Cygwin, Windows CE, and Symbian).
Based on the xUnit architecture. Supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, value- and type-parameterized tests, various options for running the tests, and XML test report generation.

(4)AMD CodeAnalyst Performance Analyzer (http://developer.amd.com/tools/CodeAnalyst/Pages/default.aspx) helps software developers to improve the performance of applications, drivers and system software. Well-tuned software delivers a better end-user experience through shorter response time, increased throughput and better resource utilization. AMD CodeAnalyst is a profiling tool used by
developers worldwide to improve the performance of games and media-oriented applications, transaction processing, and high performance scientific/engineering computation.

(5)Memory Validator,C++ memory leak detector(http://www.softwareverify.com/cpp-memory.php)Memory Validator is a memory leak and memory error detection software tool for use by software developers, software quality assurance testers and customer support staff.

(6)AQTime (http://www.automatedqa.com/downloads/aqtime/index.asp), it is one of the best profiling tools I've ever used. It isn't free but you can get a 30 day trial, so if you plan on a optimizing and profiling only one project and 30 days are enough for you then I would recommend using this application.

(7) AMD Code Analyst is free (http://developer.amd.com/tools/CodeAnalyst/Pages/default.aspx)

(8) Microsoft has there Windows Performance Analysis tools
(http://msdn.microsoft.com/en-us/performance/default.aspx)

(9)Proffy (http://www.pauldoo.com/proffy/)A native code profiler for Windows (Free software for profiling native code applications under Windows.Sampling only, no intrusive instrumentation.Call graph profiling. GUI-less. Include a single C++ header file into your application to control exactly when the profiler starts and stops.
esults saved to XML (viewable in your browser) and Graphviz "dot".Can profile multi-threaded applications.

(10) Shiny ( http://code.google.com/p/shinyprofiler/ ) is a lightning fast, fully documented & by-far-easiest-to-use C/C++/Lua profiler with no extensive surgery. Results are smoothed & shown in run-time as a call-tree or sorted-by-time. Output also renderable as graphs in Ogre3D or your custom engine

(11)Very Sleepy (http://www.codersnotes.com/sleepy/) is a C/C++ CPU profiler for Windows systems.
Very Sleepy has a boatload of improvements in, such as call-graph profiling, an improved UI, load-save, GCC support, and 64-bit support. It supports any native Windows app, if it has standard PDB or DWARF2 debugging information. No recompilation is necessary – it can just attach to any app as it’s running.
Sleepy is released under the GNU Public License, so you’re guaranteed the right to the source code and to change it how you wish.

(12)Rational Purify ( http://www-01.ibm.com/software/awdtools/purify/ and http://www-01.ibm.com/software/awdtools/purify/win/ ) is a dynamic software analysis tool .Pinpoints hard to find memory errors such as uninitialized memory access, buffer overflow and improper freeing of memory. Identifies memory leaks (memory blocks that no longer have a valid pointer). Does not require access to source code and can thus be used with third-party libraries. Supports Visual C++ &.NET Integrates with Microsoft® Visual Studio.Operating systems supported: Windows famil.
It includes two capabilities:
1) Memory debugging (pinpoints hard to find memory errors such as uninitialized memory access,
buffer overflow and improper freeing of memory),
2) Memory leak detection
(identifies memory blocks that no longer have a valid pointer).
Purify is supported on Windows, Linux, Solaris, and AIX.

(13) DevPartner (http://www.microfocus.com/products/product-trials/index.aspx?ref=ddm?dpprodtry[^])code quality, static, run time and security analysis
DevPartner is a virtual expert that automatically detects and diagnoses software defects, performance problems and security vulnerabilities lurking within application code.

(14) The Profiler - EQATEC (http://eqatec.com/ )
You’re welcome to create a free 15 days trial account and evaluate our solution on your own backed by our online documentation

P/S
You might want to look at the CRT Debug Heap (via crtdbg.h) that is already available in VS2005.
The reports are crude and there's no UI to drive it (unless you can find something on Google maybe),
but it might have the information you're looking for - and you already have it:
http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx
 
Share this answer
 
Comments
Y.Desros 12-Jul-12 16:51pm    
Very goooooooooood!!!!!!!!!!!!!
Volynsky Alex 12-Jul-12 17:04pm    
Thanks.
You can also see here: http://en.wikipedia.org/wiki/Memory_debugger
pasztorpisti 12-Jul-12 19:08pm    
+5Nice list! I can only recommend valgrind if someone develops on linux, its free and kicks ass! On windows I used 2 commercial products: Rational Purify, and Insure++. Most of the time you don't need these but running an automated valgrind test at night might bring up some interesting issues for the other day :D
Is there any reason why you would not want to use the task manager? It doesn't have a great deal of granularity but you can still see memory usage and any deltas that occur, so any blatant memory leaks are still apparent from there.

If that is not sufficient, perhaps if you specify why you need it you can get other suggestions from users.
 
Share this answer
 
v2
Comments
Stefan_Lang 11-Jul-12 5:21am    
It doesn't have a great deal of granularity
That's a rather euphemistic description of just showing a single number that isn't even usually up-to date, since the internal memory manager may delay the actual release of memory blocks for some time. A single delete usually doesn't show any effect in the task manager at all.

The only thing this is sufficient to monitor is severe memory leaks of the kind that threatens to eat all system memory. But even then you'll only catch the symptom, not the cause.
pasztorpisti 11-Jul-12 6:20am    
Yes, its totally dependent on the strategy of the allocator. In some cases the allocator might preallocate a whole heap and from outside you see no changes. One of my favorite tricks is using per module heaps to locate leaks and enforce budgets but in that case you see constant memory consumption from outside. There are a whole bunch of tricks to catch bugs and to optimize, this is why we need more info from the question owner.
Stefan_Lang 11-Jul-12 7:08am    
Indeed. Until we get more info, we can't tell whether he needs a pair of glasses, a microscope or a spy glass.
Albert Holguin 11-Jul-12 8:15am    
I never claimed it would catch the cause...
Stefan_Lang 11-Jul-12 8:22am    
True. Nor did I downvote your answer ;-)

And anyway, we don't know yet what the author is actually looking for.
See in Administrative Tools there is the Performance Monitor. You can add there Data Collector Sets, system or user defined, for any kind of resources. You can output results to binary or textual files, use results to make charts, graphs, trends, calculations. It is a very advanced tool, and it already exists in the Windows Administrative Tools.
Try to use it, and if you have more question, ask.
More exact information about memory allocations, you can get with WinDBG. You can download it for free from microsoft site. Also more advanced reports you can make with Debug Diag.
 
Share this answer
 
Comments
Lakkan 13-Jul-12 0:37am    
The requirement is simple : show memork leaks in the form of graph(memory versus time). Thanks for your solution, I hope it works ..
armagedescu 13-Jul-12 4:32am    
Don't worry, it works. You can make graphs just inside the Performance Monitor.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900