libmf 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e47f797b4e693a440bdbabb359a7c9b38141a321c5c86b3066542f26fdaae20b
4
- data.tar.gz: cbbb0b2aeb791277980a4665edfdf0f71649410e33d73a3a63fc67d4ca3a8516
3
+ metadata.gz: ca5a2bbda585f7e2f57630d20dfb6cf6091ab33e90227edd277c457af7f8dac7
4
+ data.tar.gz: 3f8a1612c831223e552cf5af4172f31080d297f2e3f059624d66790613333890
5
5
  SHA512:
6
- metadata.gz: 33e11836bb2bafd951c0bd7436bc3c371366acd9657a9daecf835b8d20bd5b4e25f20729ae814efad2d4cafa2e179f36d68fbd849922fd734c80d27777f40fe4
7
- data.tar.gz: ef2d166390e486a57c0da3335e084716a2981b89fe8e2145c4124aa0d4aceb397c76b659bf75664d18a761ca1660f5f1742d9161ec2fc6f4380ce753ace4b86a
6
+ metadata.gz: 6d8cf1bf142c4e365c2b01a10c5e407d331d24d8410f8ee2b262c6ca6c94dfe129c5ac0a3dc6ae97e0739884aaeec9483c39546714975a8e9929c8a63799f15c
7
+ data.tar.gz: 80356261c846d506160df89424b9f67d070908e1cc1f9c583e83cbbec5b7ebce272acb5146e447dd1394bb7c5d3268bf00837dc0814eb5ccb23d8c23c53efae3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.4 (2021-08-05)
2
+
3
+ - Fixed memory leak
4
+
1
5
  ## 0.2.3 (2021-03-14)
2
6
 
3
7
  - Added ARM shared library for Linux
data/lib/libmf/ffi.rb CHANGED
@@ -43,15 +43,22 @@ module Libmf
43
43
  :b, :float,
44
44
  :p, :pointer,
45
45
  :q, :pointer
46
+
47
+ def self.release(pointer)
48
+ unless pointer.null?
49
+ ref = ::FFI::MemoryPointer.new(:pointer).write_pointer(pointer)
50
+ FFI.mf_destroy_model(ref)
51
+ end
52
+ end
46
53
  end
47
54
 
48
55
  attach_function :mf_get_default_param, [], Parameter.by_value
49
56
  attach_function :mf_read_problem, [:string], Problem.by_value
50
57
  attach_function :mf_save_model, [Model.by_ref, :string], :int
51
- attach_function :mf_load_model, [:string], Model.by_ref
52
- attach_function :mf_destroy_model, [Model.by_ref], :void
53
- attach_function :mf_train, [Problem.by_ref, Parameter.by_value], Model.by_ref
54
- attach_function :mf_train_with_validation, [Problem.by_ref, Problem.by_ref, Parameter.by_value], Model.by_ref
58
+ attach_function :mf_load_model, [:string], Model.auto_ptr
59
+ attach_function :mf_destroy_model, [:pointer], :void
60
+ attach_function :mf_train, [Problem.by_ref, Parameter.by_value], Model.auto_ptr
61
+ attach_function :mf_train_with_validation, [Problem.by_ref, Problem.by_ref, Parameter.by_value], Model.auto_ptr
55
62
  attach_function :mf_predict, [Model.by_ref, :int, :int], :float
56
63
  attach_function :mf_cross_validation, [Problem.by_ref, :int, Parameter.by_value], :double
57
64
  end
data/lib/libmf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Libmf
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libmf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  requirements: []
67
- rubygems_version: 3.2.3
67
+ rubygems_version: 3.2.22
68
68
  signing_key:
69
69
  specification_version: 4
70
70
  summary: Large-scale sparse matrix factorization for Ruby