26-02-2019, 08:50 PM
(26-02-2019, 04:45 PM)mmortall Wrote: josemendez,
Am I understand you right that if Oni.UnpinMemory called twice this leads to crash?
Is there a way to debug it. For example to get Error when it is called twice or something like this?
Because I get another crash, less often. And would be great to have some way to get assert or error in case if memory get corrupted
Update:
I added this code to UnpinMemory function. Will try to locale the problem
Code:public static void UnpinMemory(GCHandle handle)
{
if (handle.IsAllocated && _AllUnlinnedHandles.Contains(handle))
{
Debug.LogError("Trying to UnpinMemory for already unpinned handler");
return;
}
if (handle.IsAllocated)
{
_AllUnlinnedHandles.Add(handle);
handle.Free();
}
}
Nope, calling unpin twice won't do anything. Unpin only does something if the memory is pinned. Will try to reproduce these issues.