Skip to content

Fix critical stability bugs and memory leaks - #32

Open
Manamama-Gemini-Cloud-AI-01 wants to merge 1 commit into
Dr-Noob:masterfrom
Manamama-Gemini-Cloud-AI-01:fix/stability-and-memory
Open

Manamama-Gemini-Cloud-AI-01 wants to merge 1 commit into
Dr-Noob:masterfrom
Manamama-Gemini-Cloud-AI-01:fix/stability-and-memory

Conversation

@Manamama-Gemini-Cloud-AI-01

Copy link
Copy Markdown

This PR addresses several critical stability issues identified while testing the project.

Changes:

  1. Zero-Initialization: Added memset to all malloc calls for core structures (benchmark, benchmark_cpu, and cpu). This prevents segmentation faults during cleanup by ensuring pointers are NULL unless explicitly initialized.
  2. Printf Padding Fix: Corrected a math error in print_bench_types_cpu where a negative padding width was passed to printf.
  3. Missing Cleanup: Implemented and declared missing cleanup functions (exit_benchmark, free_hardware, etc.) and added them to the execution paths in main.cpp to prevent memory leaks.
  4. Leak Fixes: Fixed a leak in init_benchmark_cpu where thread_set was not being freed.

Fixes #30

1. Fix segmentation fault during --list due to uninitialized memory (added memset to malloc calls).
2. Fix negative width specifier in printf within print_bench_types_cpu.
3. Add missing cleanup functions: exit_benchmark, free_hardware, free_benchmark_cpu, free_cpu_info, free_config.
4. Fix memory leaks in main.cpp and arch.cpp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segmentation fault during --list due to uninitialized memory

1 participant