Check failed: error == cudaSuccess (2 vs. 0) out of memory
<p>I am trying to run a neural network with pycaffe on gpu.</p>

<p>This works when I call the script for the first time.
When I run the same script for the second time, CUDA throws the error in the title.</p>

<p>Batch size is 1, image size at this moment is 243x322, the gpu has 8gb RAM.</p>

<p>I guess I am missing a command that resets the memory?</p>

<p>Thank you very much!</p>

<p>EDIT: </p>

<p>Maybe I should clarify a few things: I am running caffe on windows. </p>

<p>When i call the script with python script.py, the process terminates and the gpu memory gets freed, so this works.</p>

<p>With ipython, which I use for debugging, the GPU memory indeed does not get freed (after one pass, 6 of the 8 bg are in use, thanks for the nvidia-smi suggestion!)</p>

<p>So, what I am looking for is a command I can call from within pyhton, along the lines of:</p>

<p>run network</p>

<p>process image output</p>

<p><strong>free gpu memory</strong></p>

<p>Your GPU memory is not getting freed. This happens when the previous process is stopped but not terminated. See my answer <a href="http://stackoverflow.com/a/35748621/3579977">here</a>.</p>

python gpu caffe