mumble

A Lisp written in C, following the *Build Your Own Lisp* book
Log | Files | Refs | README

commit e2699172407cd8c63b70998948f1a8cb4feb0dbf
parent 35650bc85de48ef8cbc0f1a99678d17a7da40511
Author: NunoSempere <nuno.sempere@protonmail.com>
Date:   Tue,  2 May 2023 20:41:34 -0400

feat: figure out valgrind!

Diffstat:
Mmakefile | 10+++++++---
Mmumble | 0
Msrc/mumble.c | 5++++-
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/makefile b/makefile @@ -6,8 +6,8 @@ # make uninstall ## C compiler -CC=tcc # much faster compilation than gcc -COMPILER_FLAGS=#-g3 -Wall -Wextra -Wconversion -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion -fsanitize=undefined +CC=gcc # much faster compilation than gcc +COMPILER_FLAGS=#-Wall -Wextra -Wconversion -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion -fsanitize=undefined # -g3 # exclude: -fsanitize-trap, because I'm using an old version of gcc and couldn't bother getting a new one. ## ^ from <https://nullprogram.com/blog/2023/04/29/> ## <https://news.ycombinator.com/item?id=35758898> @@ -35,8 +35,12 @@ STYLE_BLUEPRINT=webkit FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) build: $(SRC) - $(CC) $(COMPILER_FLAGS) $(INCS) $(SRC) $(MPC) -o mumble $(LIBS) + $(CC) $(COMPILER_FLAGS) $(INCS) $(SRC) $(MPC) -o mumble $(LIBS) $(DEBUG) format: $(SRC) $(FORMATTER) $(SRC) +debug: + gcc -I/usr/include/editline ./src/mumble.c ./src/mpc/mpc.c -o mumble -lm -ledit -g + # valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=all ./mumble + valgrind --tool=memcheck --leak-check=yes ./mumble diff --git a/mumble b/mumble Binary files differ. diff --git a/src/mumble.c b/src/mumble.c @@ -815,6 +815,7 @@ lispval* evaluate_lispval(lispval* l, lispenv* env) // builtin_functions(operation->sym, l, env); delete_lispval(f); delete_lispval(operands); + // delete_lispval(temp); if(VERBOSE) printfln("Returning"); return answer; } @@ -921,10 +922,12 @@ int main(int argc, char** argv) delete_lispval(l); // if(VERBOSE) printfln("Deleted that ^ lispval"); // ^ I do not understand how the memory in l is freed. + // delete the ast + mpc_ast_delete(ast); } else { /* Otherwise Print the Error */ mpc_err_print(result.error); - // mpc_err_delete(result.error); + mpc_err_delete(result.error); } add_history(input); // can't add if input is NULL