Skip to content

feat: add memory leak regression tests (#105)#149

Merged
s2x merged 2 commits into
mainfrom
feat/memory-leak-regression-tests
May 30, 2026
Merged

feat: add memory leak regression tests (#105)#149
s2x merged 2 commits into
mainfrom
feat/memory-leak-regression-tests

Conversation

@s2x

@s2x s2x commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds memory leak regression tests for FFI memory safety as specified in #105.

Changes

  • 5 new .phpt test files for memory leak detection:
    • test_memory_collection_lifecycle.phpt - 50x create/open/close/destroy cycle
    • test_memory_deserialize_buffer.phpt - 100x serialize/deserialize cycle
    • test_memory_query_output_fields.phpt - 100x query with/without output fields
    • test_memory_init_error_path.phpt - 20x init error/recovery cycles
    • test_memory_delete_cstrings.phpt - 30x insert/delete/fetch cycles
  • New example: examples/07_memory_management.php - FFI memory cleanup patterns with VmRSS monitoring
  • Documentation: Updated CHANGELOG.md and AGENTS.md with memory leak regression test section

Testing

  • All 143 tests pass (140 PASS, 1 skipped, 2 expected fail)
  • Each test uses try-finally with uniqid() temp directory under test_dbs/
  • Tests verify both PHP heap and native memory stability with 500KB threshold

Closes

Closes #105

s2x added 2 commits May 30, 2026 15:19
- Add 5 .phpt test files for FFI memory leak detection:
  - test_memory_collection_lifecycle.phpt: 50x create/open/close/destroy cycle
  - test_memory_deserialize_buffer.phpt: 100x serialize/deserialize cycle
  - test_memory_query_output_fields.phpt: 100x query with/without output fields
  - test_memory_init_error_path.phpt: 20x init error/recovery cycles
  - test_memory_delete_cstrings.phpt: 30x insert/delete/fetch cycles
- Add examples/07_memory_management.php with VmRSS monitoring patterns
- Update CHANGELOG.md with test entries
- Update AGENTS.md with memory leak regression test section
@s2x s2x merged commit e043d76 into main May 30, 2026
3 checks passed
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.

TEST-007: Memory Leak Regression Tests

1 participant