/// <summary> /// /// </summary> /// <param name="count">The number of items in this array.</param> /// <param name="properties">How many properties typed double are for every <see cref="count"/></param> public DoubleArrayUnmanaged(int count, int properties, bool zeroValues = false) : base(count, properties) { var addr = Address = (double *)Marshal.AllocHGlobal(count * properties * sizeof(double)); disposer = () => DisposerThread.Enqueue(addr); if (zeroValues) { Fill(0); } }
private static void _disposer(GCHandle handle) { DisposerThread.Enqueue(handle); }
static DisposerThread() { Instance = new DisposerThread(); InstanceQueue = Instance.queue; }