Browse Source

fixed Tensor memory leak.

tags/v0.9
haiping008 6 years ago
parent
commit
2f29995d14
2 changed files with 4 additions and 3 deletions
  1. +3
    -2
      src/TensorFlowNET.Core/Sessions/BaseSession.cs
  2. +1
    -1
      src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs

+ 3
- 2
src/TensorFlowNET.Core/Sessions/BaseSession.cs View File

@@ -186,9 +186,10 @@ namespace Tensorflow
var result = new NDArray[fetch_list.Length];

for (int i = 0; i < fetch_list.Length; i++)
{
result[i] = fetchValue(output_values[i]);
}

for (int i = 0; i < feed_dict.Length; i++)
feed_dict[i].Value.Dispose();

return result;
}


+ 1
- 1
src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs View File

@@ -111,7 +111,7 @@ namespace Tensorflow
// Free the original buffer and set flag
Deallocator deallocator = (IntPtr values, IntPtr len, ref bool closure) =>
{
Marshal.FreeHGlobal(dotHandle);
Marshal.FreeHGlobal(values);
closure = true;
};



Loading…
Cancel
Save