Thread: valgrind

valgrind

From
Peter Kroon
Date:
Hi list,

I've Installed postgresql-9.4 using apt-get as instructed here: http://www.postgresql.org/download/linux/debian/
Also installed libpq-dev with the suggested dependencies using apt-get.
And created a small program in c. You can find it here: http://pastebin.com/bRHw3Wud
When I run the progam against valgrind I get:


==3814== Memcheck, a memory error detector
==3814== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==3814== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==3814== Command: ./pgsql_check
==3814==
==3814==
==3814== HEAP SUMMARY:
==3814==     in use at exit: 47,288 bytes in 2,864 blocks
==3814==   total heap usage: 5,671 allocs, 2,807 frees, 331,460 bytes allocated
==3814==
==3814== LEAK SUMMARY:
==3814==    definitely lost: 0 bytes in 0 blocks
==3814==    indirectly lost: 0 bytes in 0 blocks
==3814==      possibly lost: 0 bytes in 0 blocks
==3814==    still reachable: 47,288 bytes in 2,864 blocks
==3814==         suppressed: 0 bytes in 0 blocks
==3814== Rerun with --leak-check=full to see details of leaked memory
==3814==
==3814== For counts of detected and suppressed errors, rerun with: -v
==3814== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

There is still reachable data. Is this a bug or have I forgotten to free something?

Best,
Peter

Re: valgrind

From
Albe Laurenz
Date:
Peter Kroon wrote:
> ==3814== Memcheck, a memory error detector
> ==3814== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
> ==3814== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
> ==3814== Command: ./pgsql_check
> ==3814==
> ==3814==
> ==3814== HEAP SUMMARY:
> ==3814==     in use at exit: 47,288 bytes in 2,864 blocks
> ==3814==   total heap usage: 5,671 allocs, 2,807 frees, 331,460 bytes allocated
> ==3814==
> ==3814== LEAK SUMMARY:
> ==3814==    definitely lost: 0 bytes in 0 blocks
> ==3814==    indirectly lost: 0 bytes in 0 blocks
> ==3814==      possibly lost: 0 bytes in 0 blocks
> ==3814==    still reachable: 47,288 bytes in 2,864 blocks
> ==3814==         suppressed: 0 bytes in 0 blocks
> ==3814== Rerun with --leak-check=full to see details of leaked memory
> ==3814==
> ==3814== For counts of detected and suppressed errors, rerun with: -v
> ==3814== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
> 
> There is still reachable data. Is this a bug or have I forgotten to free something?

I'd recommend that you do as valgrind suggests and use --leak-check=full to see
where it thinks the problems are.

Yours,
Laurenz Albe