PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] How to see memory allocated and freed with Valgrind?
Date: Tuesday, 29 Sep 2020, 18:23:40


    > Message Posted By: Unknown
    >
    > Usually, we can run valgrind -q with our executable to see the number of
    > bytes allocated and freed. But currently, since we have an input, I can't
    > see any valgrind output. Is there a workaround?

% echo a | valgrind --leak-check=full ./parsley
==1286337== Memcheck, a memory error detector
==1286337== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1286337== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==1286337== Command: ./parsley
==1286337==
(1)$ CMD (Depth = 0):  SIMPLE,  argv[0] = a
(2)$
==1286337==
==1286337== HEAP SUMMARY:
==1286337==     in use at exit: 0 bytes in 0 blocks
==1286337==   total heap usage: 8 allocs, 8 frees, 5,373 bytes allocated
==1286337==
==1286337== All heap blocks were freed -- no leaks are possible
==1286337==
==1286337== For lists of detected and suppressed errors, rerun with: -s
==1286337== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

You can also redirect stdin to a file or pipe.

--Stan-
PREV INDEX NEXT