hornetsnest
hornetsnest copied to clipboard
The initialization function doesn’t deallocate the memory before reallocating
https://github.com/hornet-gt/hornet/blob/master/include/Core/DataLayout/DataLayout.i.cuh
One example shown below and there are additional similar issues. :
178 template<typename... TArgs>
179 void AoS<TArgs...>::initialize(const void* (&array)[sizeof...(TArgs)],
180 int num_items) noexcept {
181 _num_items = num_items;
182 _h_ptr = new AoSData<TArgs...>[num_items];
183 for (auto i = 0; i < num_items; i++)
184 _h_ptr[i] = AoSData<TArgs...>(array, i);
185 cuMalloc(_d_ptr_, num_items); //Issue: _d_ptr_ should have been freed before allocating
186 cuMemcpyToDevice(_h_ptr, num_items, _d_ptr);
187 }