I am using the new Google Colaboratory, and I ran a block of code repeatedly that utilized a tf.InteractiveSession
before I realized that tf.InteractiveSession.close()
was never called. I modified the code and added a sess.close()
. Now whenever I run the same code block, I get the following warning:
/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py:1645: UserWarning: An interactive session is already active. This can cause out-of-memory errors in some cases. You must explicitly call
InteractiveSession.close()
to release resources held by the other session(s). warnings.warn('An interactive session is already active. This can '
Whoops. How can I release resources held by the previous sessions I spawned? Even after adding the sess.close()
command, this warning persists. I assume I am only closing the active session at this point. I tried refreshing the page, but no luck.
- Yeah, in case you can't tell I'm not very familiar with the inner workings (including memory management and state persistence) of Jupyter notebooks.
This question is very similar to: Is it necessary to close session after tensorflow InteractiveSession()? but I need to know how to actually close the zombie processes, which isn't covered in this answer.