somaticio / tensorflow.rb

tensorflow for ruby
BSD 3-Clause "New" or "Revised" License
827 stars 66 forks source link

Got memory leak error when I use Tensorflow::Tensor.new(array, :float) #106

Open baibonjwa opened 6 years ago

baibonjwa commented 6 years ago

When I build an complex tensor using the Tensorflow::Tensor.new(array, :float), I got a memory leak error(seems only happened on a big array). It maybe an memory malloc issue. When I change the data_size of Tensorflow::TF_FLOAT to 4(original value is 8) and the issue will be fixed. Is this a bug or it depends on my local C++ compiler or my usage issue? Here is the code: https://github.com/somaticio/tensorflow.rb/blob/master/lib/tensorflow/tensor.rb#L76