Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Valgrind & ccmalloc reporting garbage with simple hello world program

Status
Not open for further replies.

Flappy

Programmer
Jul 30, 2002
35
AU
Valgrind & ccmalloc are reporting that there is a memory leak with this:

Code:
#include <iostream>

using namespace std;

int main(int argc, char** argv) {
  cout << "Hello World\n";
  return 0;
}


Valgrind says:
==26081==
==26081== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==26081== malloc/free: in use at exit: 116 bytes in 1 blocks.
==26081== malloc/free: 1 allocs, 0 frees, 116 bytes allocated.
==26081== For a detailed leak analysis, rerun with: --leak-check=yes
==26081== For counts of detected errors, rerun with: -

ccmalloc says:
.---------------.
|ccmalloc report|
=======================================================
| total # of| allocated | deallocated | garbage |
+-----------+-------------+-------------+-------------+
| bytes| 116 | 0 | 116 |
+-----------+-------------+-------------+-------------+
|allocations| 1 | 0 | 1 |
+-----------------------------------------------------+

how can there be a memory leak when no allocations are made?
 
hmmm... This is what I get from valgrind:
[tt]
==28881== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==28881== malloc/free: in use at exit: 0 bytes in 0 blocks.
==28881== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==28881== For counts of detected errors, rerun with: -v
==28881== No malloc'd blocks -- no leaks are possible.
[/tt]
I didn't try ccmalloc, but -lefence doesn't show any problems either...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top