Skip to content

Commit 00448e6

Browse files
committed
Fixed memory leak
1 parent 9ee09db commit 00448e6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.1 (unreleased)
2+
3+
- Fixed memory leak
4+
15
## 0.3.0 (2025-04-03)
26

37
- Dropped support for Ruby < 3.2

lib/thundersvm/model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def create_dataset(x, y = nil)
158158
end
159159

160160
def str_ptr(arr)
161-
ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP * arr.size)
161+
ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP * arr.size, Fiddle::RUBY_FREE)
162162
arr.each_with_index do |v, i|
163163
ptr[i * Fiddle::SIZEOF_VOIDP, Fiddle::SIZEOF_VOIDP] = Fiddle::Pointer["#{v}\x00"].ref
164164
end

0 commit comments

Comments
 (0)