When running phc_solve.c (compiled with -fsanitize=address), I encountered the following issue:
gcc phc_solve.c solcon.c syscon.c phcpack.c ../../../libPHCpack.so -fsanitize=address
Running PHCv2.4.88 released 2023-12-26 ...
MENU for the working precision :
0. standard double precision;
1. double double precision;
2. quad double precision.
Type 0, 1, or 2 to select the precision : 0
Welcome to the blackbox solver in PHCpack :
1. the input polynomial system will be typed in; or
2. the system typed in is a Laurent polynomial system; or
3. an input file contains the input polynomial system; or
4. the input Laurent system is on an input file.
Type 1, 2, 3, or 4 to make your choice : 1
Give the number of polynomials in the system : 1
Reading 1 polynomials, terminate each with ; (semicolon)...
-> polynomial 1 : x^2-1;
The system in the container :
1
x^2-1;
Give the number of tasks : 1
Focus on polynomials (1 = yes, 0 = no) : 1
Give the verbose level : 0
THE ROOT COUNTS :
mixed volume : 2
stable mixed volume : 2
The root count : 2
interactive selection of solutions...
Give an index to a solution (-1 to exit) : -1
=================================================================
==2316872==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1344 byte(s) in 20 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
Direct leak of 216 byte(s) in 2 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x74216689a372 in mixedvol_algorithm__mv (../../../libPHCpack.so+0xa9a372)
Direct leak of 48 byte(s) in 2 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x742165f10590 in black_box_mixed_volumes__mixed_volume (../../../libPHCpack.so+0x110590)
Direct leak of 48 byte(s) in 1 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x7421671daeb1 in root_counters_output__mixed_volumes_to_string__2 (../../../libPHCpack.so+0x13daeb1)
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x7421663b7ce6 in drivers_for_mixedvol_algorithm__mixed_volume_computation (../../../libPHCpack.so+0x5b7ce6)
#3 0x742165f365aa in black_mixed_volume_computations__black_box_mixed_volume_computation__4 (../../../libPHCpack.so+0x1365aa)
#4 0x742165f10590 in black_box_mixed_volumes__mixed_volume (../../../libPHCpack.so+0x110590)
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x742165f365aa in black_mixed_volume_computations__black_box_mixed_volume_computation__4 (../../../libPHCpack.so+0x1365aa)
#3 0x742165f10590 in black_box_mixed_volumes__mixed_volume (../../../libPHCpack.so+0x110590)
Indirect leak of 1792 byte(s) in 43 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
Indirect leak of 64 byte(s) in 2 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x74216689c751 in mixedvol_algorithm__labels_to_mixed_cell__2 (../../../libPHCpack.so+0xa9c751)
#3 0x74216689ca6c in mixedvol_algorithm__create_mixed_cell_configuration__2 (../../../libPHCpack.so+0xa9ca6c)
Indirect leak of 56 byte(s) in 2 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x74216689ca6c in mixedvol_algorithm__create_mixed_cell_configuration__2 (../../../libPHCpack.so+0xa9ca6c)
Indirect leak of 48 byte(s) in 2 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x7421664b73a5 in exponent_vectors__create__7 (../../../libPHCpack.so+0x6b73a5)
Indirect leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x742167efd9c7 in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
#1 0x7421677e1c21 in __gnat_malloc /home/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-linux/gcc/build/gcc/ada/rts/s-memory.adb:79
#2 0x74216689a372 in mixedvol_algorithm__mv (../../../libPHCpack.so+0xa9a372)
SUMMARY: AddressSanitizer: 3688 byte(s) leaked in 77 allocation(s).
Initially, I suspected this might be a false positive. However, after running the program in a loop with a simple input (solve x^2-1;), I observed that the program's memory usage increases rapidly.
This suggests that there is a genuine memory leak in the code. I would appreciate it if someone could investigate this issue further.
When running
phc_solve.c(compiled with-fsanitize=address), I encountered the following issue:Initially, I suspected this might be a false positive. However, after running the program in a loop with a simple input (
solve x^2-1;), I observed that the program's memory usage increases rapidly.This suggests that there is a genuine memory leak in the code. I would appreciate it if someone could investigate this issue further.