hughperkins / cltorch

An OpenCL backend for torch.
Other
289 stars 26 forks source link

Memory leak when calling :set() #64

Closed fmassa closed 8 years ago

fmassa commented 8 years ago

Follow up on the bug mentioned on https://github.com/szagoruyko/cifar.torch/pull/17#issuecomment-210494811

The bug with clearState is in here I think. Compare it to the cutorch version. Basically in torch, if we call tensor:set() (without arguments) it frees the storage of tensor. In your case you only free it if the provided argument has non-null storage.

hughperkins commented 8 years ago

Whoa, nice spot :-O That works perfectly :-) That would have taken me forever to find. I thought it was a bug in my network modules, and would have spent hours digging out wondering why hacking around in the network modules wasnt fixing anything :-D

Thank you very much. Awesome! :-)

fmassa commented 8 years ago

Great ! Glad I could be helpful ! :)