taliesinb opened a new issue #12394: C API documentation often doesn't mention 
returned pointer lifetimes
URL: https://github.com/apache/incubator-mxnet/issues/12394
 
 
   Take a function from the C API like `MXNDArrayGetShape`, which sets a 
pointer to shape data of an `NDArray`. 
   
   It is not documented at 
https://mxnet.incubator.apache.org/doxygen/c__api_8h.html#a2035651f4392d249d1b904d5eb0c3406
 how long this data lasts, where and how it as allocated, and whether the 
caller is responsible for freeing it.
   
   By chasing things down to `MXAPIThreadLocalEntry` I see that this shape 
buffer is thread-local and will last until the next call to either 
`MXNDArrayGetShape` or `MXSymbolInferShape`. That's an important fact to 
document to be able to use the API correctly! If this is documented already 
somewhere, that's good, but then a reference to this section should be included 
in a doxygen `warn` field of `MXNDArrayGetShape` etc. 

----------------------------------------------------------------
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