tlby commented on a change in pull request #12038: MXNET-776 [Perl] Better 
documentation/bug fixes.
URL: https://github.com/apache/incubator-mxnet/pull/12038#discussion_r208260635
 
 

 ##########
 File path: perl-package/AI-MXNetCAPI/mxnet_typemaps.i
 ##########
 @@ -1215,5 +1215,5 @@
 
 %typemap(in) (void* callback_handle)
 {
-    $1 = (void*)$input;
+    $1 = (void*)newSVsv($input);
 
 Review comment:
   I suspect you had to do this because  you found`$input` was getting freed?  
newSVsv() will return a copy with a refcount of 1 preventing that, but 
`SvREFCNT_inc($input)` would likely have worked here as well with less effort.  
But in both cases, we probably need an `SvREFCNT_dec(...)` somewhere to avoid a 
(small) memory leak. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to