You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An array can have various memory management policy: duplicate, neverDelete, deleteWhenDone...
Calling array.free(), doesn't release memory of array having neverDelete policy.
Unfortunately there is no way to check what policy was used at array creation time, so it cannot be determined if array data should be released manually or not. Moreover, array.free() nullifies a pointer to data even if memory was not automatically deallocated.
Potential solutions:
A) (the simples one) to not nullify _data private variable if memory was not automatically deallocated. After calling array.free(), user may check if pointer is valid - if so, memory can be freed manually.
B) to expose memory policy via array method to provide user knowledge if an array must be deallocated manually
The text was updated successfully, but these errors were encountered:
Thank you for reporting it!
IIUC, option B has the advantage of not changing the existing behaviour.
Would it be possible for you to create a PR for it?
Thanks,
Sylwester
An array can have various memory management policy: duplicate, neverDelete, deleteWhenDone...
Calling array.free(), doesn't release memory of array having neverDelete policy.
Unfortunately there is no way to check what policy was used at array creation time, so it cannot be determined if array data should be released manually or not. Moreover, array.free() nullifies a pointer to data even if memory was not automatically deallocated.
Potential solutions:
A) (the simples one) to not nullify _data private variable if memory was not automatically deallocated. After calling array.free(), user may check if pointer is valid - if so, memory can be freed manually.
B) to expose memory policy via array method to provide user knowledge if an array must be deallocated manually
The text was updated successfully, but these errors were encountered: