Skip to content

Just a sample memory leak and some instructions for finding it.

Notifications You must be signed in to change notification settings

cisc220/valgrind-basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

#Simple Memory Leak Example

So be careful with this one, you'll lose 40 bytes at a time.

Here is how to use this. When we compile let's add one flag

g++ -g leak.cpp

Then we can use a tool called valgrind to spot memory leaks for us:

valgrind --leak-check=yes ./a.out

Observe what it says about the lost Heap memory.

About

Just a sample memory leak and some instructions for finding it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages