# comment, just to show error in line 3
d/dt(y) = -ka;
C1 = /y;
I name it bad.txt
From the terminal you can see some of the memory is lost:
matt@localhost ~/src/dparser $ valgrind ./sample_parser bad.txt
==2465== Memcheck, a memory error detector
==2465== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2465== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==2465== Command: ./sample_parser bad.txt
==2465==
:3: syntax error after '='
fatal error, '' line 3
==2465==
==2465== HEAP SUMMARY:
==2465== in use at exit: 11,312 bytes in 37 blocks
==2465== total heap usage: 403 allocs, 366 frees, 288,690 bytes allocated
==2465==
==2465== LEAK SUMMARY:
==2465== definitely lost: 136 bytes in 1 blocks
==2465== indirectly lost: 11,176 bytes in 36 blocks
==2465== possibly lost: 0 bytes in 0 blocks
==2465== still reachable: 0 bytes in 0 blocks
==2465== suppressed: 0 bytes in 0 blocks
==2465== Rerun with --leak-check=full to see details of leaked memory
==2465==
==2465== For lists of detected and suppressed errors, rerun with: -s
==2465== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
There is a small memory leak with bad syntax. Here is a reproducible example.
sample.g
with the grammar heredparser
packageI name it
bad.txt
From the terminal you can see some of the memory is lost: