提交 5a755867 authored 作者: Frederic Bastien's avatar Frederic Bastien

fix gpu memory leak.

上级 46ab3d8b
...@@ -1217,7 +1217,8 @@ CudaNdarray_inplace_add_div(PyObject* py_self, PyObject * py_other, int fct_nb) ...@@ -1217,7 +1217,8 @@ CudaNdarray_inplace_add_div(PyObject* py_self, PyObject * py_other, int fct_nb)
static PyObject * static PyObject *
CudaNdarray_inplace_add(PyObject* py_self, PyObject * py_other){ CudaNdarray_inplace_add(PyObject* py_self, PyObject * py_other){
CudaNdarray_inplace_add_div(py_self, py_other, 0); CudaNdarray_inplace_add_div(py_self, py_other, 0);
Py_INCREF(py_self); //We should not increment the refcount as we are doing inplace operation
//And in this syntax, their is no additional reference created!
return py_self; return py_self;
} }
...@@ -1228,7 +1229,8 @@ CudaNdarray_inplace_add(PyObject* py_self, PyObject * py_other){ ...@@ -1228,7 +1229,8 @@ CudaNdarray_inplace_add(PyObject* py_self, PyObject * py_other){
static PyObject * static PyObject *
CudaNdarray_inplace_div(PyObject* py_self, PyObject * py_other){ CudaNdarray_inplace_div(PyObject* py_self, PyObject * py_other){
CudaNdarray_inplace_add_div(py_self, py_other, 1); CudaNdarray_inplace_add_div(py_self, py_other, 1);
Py_INCREF(py_self); //We should not increment the refcount as we are doing inplace operation
//And in this syntax, their is no additional reference created!
return py_self; return py_self;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论