eyalroz / cuda-api-wrappers

Thin, unified, C++-flavored wrappers for the CUDA APIs
BSD 3-Clause "New" or "Revised" License
766 stars 79 forks source link

Managed memory deleter uses wrong free() function leaks PC reference #645

Closed eyalroz closed 3 months ago

eyalroz commented 4 months ago

When we allocate managed memory, we increase the refcount of the first device's primary context - since we need at least some primary context active for the allocation to succeed. That means that the deleter must decrease the refcount. Unfortunately, the current deleter code calls the wrong version of free() - which doesn't do this.