Managing releasing of arrays in the C API

33 views
Skip to first unread message

Aaron Hsu

unread,
Nov 14, 2022, 12:04:00 AM11/14/22
to ArrayFire Users
With the C API, with operations like this:

af_cast(A, B, ...);
af_retain_array(A, B);
af_tile(A, B, ...);

And so forth, if *A == B, will this cause a memory leak? That is, will ArrayFire recognize that it is overwriting a location and therefore, it is necessary to first release the array before overwriting the location, or will you need to ensure that *A != B and then af_release_array(B) if you no longer need B after creating *A?

--
Aaron W. Hsu | arc...@sacrideo.us | http://www.sacrideo.us
Reply all
Reply to author
Forward
0 new messages