I'm converting a managed System.Action to an unmanaged std::function inside a C++/CLI project; should I release the given IntPtr after using the callback, or is it unnecessary?
void MyClass::Execute(System::Action^ callback)
{
IntPtr callbackPtr = Marshal::GetFunctionPointerForDelegate(callback);
std::function<void (void)> nativeCallback = static_cast<void (__stdcall *) (void)>(callbackPtr.ToPointer());
m_nativeObject->Execute(wrappedCallback);
// should I release callbackPtr here?
}