Skip to content

fix(#67): fix memory leaks and wrong sizeof#68

Merged
LeoBuron merged 1 commit intomainfrom
fix-67-memory-bugs
Apr 14, 2026
Merged

fix(#67): fix memory leaks and wrong sizeof#68
LeoBuron merged 1 commit intomainfrom
fix-67-memory-bugs

Conversation

@LeoBuron
Copy link
Copy Markdown
Member

@LeoBuron LeoBuron commented Apr 9, 2026

Summary

Fixes #67 — three pre-existing bugs found during #66 review:

  • Validation loop memory leak (inferenceStats): inferenceWithLoss() called 10K×/epoch with return value never freed → added freeInferenceStats(validationResult)
  • Validation loop memory leak (batch): getBatch() allocations never freed in the same loop → added freeBatch(batch)
  • Wrong sizeof in batch allocation: sizeof(sample_t) instead of sizeof(sample_t *) for a sample_t ** array → over-allocates 2× on 64-bit

Test plan

  • cmake --build --preset unit_test_debug compiles cleanly
  • ctest --preset unit_test_debug — all 26 tests pass
  • CI passes

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

@LeoBuron LeoBuron requested a review from HerrCooker April 9, 2026 11:31
@LeoBuron LeoBuron self-assigned this Apr 9, 2026
@LeoBuron LeoBuron changed the title fix(#67): fix memory leaks and wrong sizeof in validation loop fix(#67): fix memory leaks and wrong sizeof Apr 9, 2026
@LeoBuron LeoBuron merged commit 152e95a into main Apr 14, 2026
2 checks passed
@LeoBuron LeoBuron deleted the fix-67-memory-bugs branch April 14, 2026 13:45
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.

Fix pre-existing memory and allocation bugs

2 participants