Closed jzylkin closed 9 months ago
Not sure what you are talking about? The NdArray
destructor calls deleteArray()
which deallocates the heap memory.
void deleteArray() noexcept
{
if (ownsPtr_ && array_ != nullptr)
{
allocator_.deallocate(array_, size_);
}
array_ = nullptr;
shape_.rows = shape_.cols = 0;
size_ = 0;
ownsPtr_ = false;
endianess_ = Endian::NATIVE;
}
Hi David,
I was looking at an older release from this February. I did not realize you fixed this already. Thanks for getting back to me!
Jack
On Thu, Dec 7, 2023 at 4:11 PM David Pilger @.***> wrote:
Not sure what you are talking about? The NdArray destructor calls deleteArray() which deallocates the heap memory.
void deleteArray() noexcept { if (ownsPtr && array != nullptr) { allocator.deallocate(array, size_); }
array_ = nullptr; shape_.rows = shape_.cols = 0; size_ = 0; ownsPtr_ = false; endianess_ = Endian::NATIVE;
}
— Reply to this email directly, view it on GitHub https://github.com/dpilger26/NumCpp/issues/207#issuecomment-1846298075, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKIXJCEUAOWRKQL4DAFNL3YIJLMFAVCNFSM6AAAAABALYLX52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBWGI4TQMBXGU . You are receiving this because you authored the thread.Message ID: @.***>
Describe the bug The NdArray<> class can allocate memory to create the underlying
_array
using std:allocator, but its destructor does not deallocate this memory.To Reproduce Steps to reproduce the behavior:
Expected behavior I expect the NdArray object to clean up the memory it creates when it is destroyed.