Richard Hipp <drh at sqlite.org> wrote:

> On 7/17/15, Sairam Gaddam <gaddamsairam at gmail.com> wrote:
>> I ran the test files which are present in SQLite for my custom build and I
>> got some memory leaks.
>> I got a message like,
>>
>> Writing unfreed memory log to "./memleak.txt"
>>
>> But I couldn't able to locate that file.
>> Can anyone kindly tell where to find that file or where the unfreed memory
>> log is written ???
>
> I think memleak.txt is only created if you compile with -DSQLITE_MEMDEBUG.
>
> Use valgrind instead.  It works much better.

Or use the leak sanitizer (part of address sanitizer) which is faster
than valgrind:

- compile your program with gcc or clang with: -fsanitize=address
-fno-omit-frame-pointer
- add detect_leaks=1 to ASAN_OPTIONS environment variable. Ex:
export 
ASAN_OPTIONS=abort_on_error=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=0:color=1:detect_leaks=1:detect_odr_violation=2
- run you program. It will report leaks if any, and other memory bugs.

https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer
https://code.google.com/p/address-sanitizer/wiki/Flags

Regards
Dominique

Reply via email to