提交 7469193c authored 作者: Frederic Bastien's avatar Frederic Bastien

Fix a memory leak

上级 6acd1b7e
...@@ -388,7 +388,8 @@ KERNEL void k_multi_warp_multinomial_wor( ...@@ -388,7 +388,8 @@ KERNEL void k_multi_warp_multinomial_wor(
if (theano_prep_output(&out, 2, dims, GA_LONG, if (theano_prep_output(&out, 2, dims, GA_LONG,
GA_C_ORDER, %(ctx)s) != 0){ GA_C_ORDER, %(ctx)s) != 0){
%(fail)s Py_DECREF(pvals_copy);
%(fail)s
} }
%(out)s = out; %(out)s = out;
...@@ -416,6 +417,7 @@ KERNEL void k_multi_warp_multinomial_wor( ...@@ -416,6 +417,7 @@ KERNEL void k_multi_warp_multinomial_wor(
PyExc_ValueError, PyExc_ValueError,
"Multinomial is not implemented for so many rows in the matrix (%%i)", "Multinomial is not implemented for so many rows in the matrix (%%i)",
nb_multi); nb_multi);
Py_DECREF(pvals_copy);
%(fail)s %(fail)s
} }
...@@ -460,16 +462,18 @@ KERNEL void k_multi_warp_multinomial_wor( ...@@ -460,16 +462,18 @@ KERNEL void k_multi_warp_multinomial_wor(
"gpuarray error: %%s: %%s.\\n", "gpuarray error: %%s: %%s.\\n",
"k_multi_warp_%(name)s", "k_multi_warp_%(name)s",
GpuKernel_error(&%(kname)s, err)); GpuKernel_error(&%(kname)s, err));
%(fail)s; Py_DECREF(pvals_copy);
%(fail)s;
} }
if(%(sync)d) if(%(sync)d)
GpuArray_sync(&(out->ga)); GpuArray_sync(&(out->ga));
Py_DECREF(pvals_copy);
} // END NESTED SCOPE } // END NESTED SCOPE
""" % locals() """ % locals()
return s return s
def c_code_cache_version(self): def c_code_cache_version(self):
return (3,) return (4,)
@register_opt('fast_compile') @register_opt('fast_compile')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论