aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile7
-rw-r--r--src/main.c2
-rw-r--r--src/nn.c3
4 files changed, 13 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 4b5e2c4..3faff71 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,4 +11,5 @@ utils/*.gpi
*.bin
utils/*.py
tests/*.png
+leaks.log
issues.txt
diff --git a/Makefile b/Makefile
index 7223e7b..b829f3d 100644
--- a/Makefile
+++ b/Makefile
@@ -61,5 +61,12 @@ debug: build
gdb -x utils/commands.gdb --tui --args ${BIN} train data/xor.json -e 100
@#gdb -x utils/commands.gdb --tui --args ${BIN} predict data/sample_data.json
+check_leaks: build
+ valgrind --leak-check=yes \
+ --log-file=leaks.log \
+ --leak-check=full \
+ --show-leak-kinds=all \
+ ./${BIN} train -c utils/settings.cfg data/xor.json
+
clean:
@rm $(OBJDIR) -rv
diff --git a/src/main.c b/src/main.c
index 63a2fa9..01ada0a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -152,6 +152,8 @@ int main(int argc, char *argv[]) {
nn_network_free_weights(network, ml_configs.network_size);
free(network);
+ free(X.data);
+ free(y.data);
util_free_config(&ml_configs);
return 0;
}
diff --git a/src/nn.c b/src/nn.c
index 19076bb..e905bf3 100644
--- a/src/nn.c
+++ b/src/nn.c
@@ -170,6 +170,9 @@ void nn_network_train(
free(weights);
free(biases);
+ free(input_random);
+ free(labels_random);
+
return;
nn_network_train_error:
perror("nn_network_train() Error");
Feel free to download, copy and edit any repo