mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 06:15:08 +00:00
Fixed a problem where the ADL Main_Memory_Alloc callback delegate could be garbage collected while still in use.
This commit is contained in:
@@ -267,9 +267,11 @@ namespace OpenHardwareMonitor.Hardware.ATI {
|
||||
|
||||
private delegate IntPtr ADL_Main_Memory_AllocDelegate(int size);
|
||||
|
||||
private static IntPtr Main_Memory_Alloc(int size) {
|
||||
return Marshal.AllocHGlobal(size);;
|
||||
}
|
||||
// create a Main_Memory_Alloc delegate and keep it alive
|
||||
private static ADL_Main_Memory_AllocDelegate Main_Memory_Alloc =
|
||||
delegate(int size) {
|
||||
return Marshal.AllocHGlobal(size);
|
||||
};
|
||||
|
||||
private static void Main_Memory_Free(IntPtr buffer) {
|
||||
if (IntPtr.Zero != buffer)
|
||||
|
Reference in New Issue
Block a user