Description
When trying to upgrade to 0.3.1 we got junit failures in a class with multiple
tests that load and use saved models with string inputs and outputs.
Tensorflow was for some tests throwing an exception with a message that definitely was wrong.
When the tests were run individually, no error occured.
When the tests were reordered, different tests were failing.
So this smells likely a memory corruption, and I've looked at the changes in 0.3.1 (w.r.t. 0.3.0),
namely #253.
I think I've understood the issue: The problem appears if the underlying TensorBuffers are shared, in which case
the strings should not be deallocated.
I'll send a PR which uses TF_TensorMaybeMove (which in its current implementation returns null if then TensorBuffer is shared, and the tensor itself, if it is not) to detect and avoid the situation (the PR fixes the problem for us)