Skip to content

Conversation

@tompng
Copy link
Member

@tompng tompng commented Sep 9, 2025

Avoid memory leak when TypedData_Wrap_Struct fail.

  • First, prepare TypedData_Wrap_Struct with NULL.
  • Next, allocate Real.
  • Finally, bind VALUE and Real.

This was already done in f141928, partially broken in some commit, and accidentally dropped in #410

TODO

  • BigDecimal does not run test_no_memory_leak_BigDecimal test_no_memory_leak_create test in CI.

@tompng tompng force-pushed the fix_memory_leak_test branch 2 times, most recently from 42e8b4f to 0a104d4 Compare September 9, 2025 11:48
Avoid memory leak when TypedData_Wrap_Struct fail.
First, prepare TypedData_Wrap_Struct with NULL.
Next, allocate Real.
Finally, bind VALUE and Real.
@tompng tompng force-pushed the fix_memory_leak_test branch from 0a104d4 to 7ca76fa Compare September 9, 2025 11:54
@tompng tompng merged commit 021c554 into ruby:master Sep 9, 2025
81 checks passed
@tompng tompng deleted the fix_memory_leak_test branch September 9, 2025 12:09
nobu added a commit to nobu/ruby that referenced this pull request Oct 1, 2025
@nobu nobu mentioned this pull request Oct 1, 2025
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.

1 participant