SwiftDotNetCapsule(IntPtr p, SwiftObjectRegistry registry)
        {
            SwiftObject = p;
#if DEBUG
            //Console.WriteLine ("Constructing SwiftDotNetCapsule.");
            //Console.WriteLine ("Passed " + p.ToString("X8"));
            //SwiftMarshal.Memory.Dump (p, 128);
            //Console.WriteLine ($"Retain count {SwiftCore.RetainCount (p)}, Weak retain count {SwiftCore.WeakRetainCount (p)}");
#endif
            registry.Add(this);
            AllocCalled?.Invoke(null, new CapsuleTrackArgs(this));
        }
        public SwiftDotNetCapsule(IntPtr p)
        {
            SwiftObject = AllocCapsule(p);
#if DEBUG
            //Console.WriteLine ("Constructing SwiftDotNetCapsule.");
            //Console.WriteLine ("Passed " + p.ToString ("X8"));
            //if (p != IntPtr.Zero) {
            //	SwiftMarshal.Memory.Dump (p, 128);
            //	Console.WriteLine ($"Retain count {SwiftCore.RetainCount (p)}, Weak retain count {SwiftCore.WeakRetainCount (p)}");
            //}
            //Console.WriteLine ("Capsule swift object: " + SwiftObject.ToString ("X8"));
            //Console.WriteLine ($"Retain count {SwiftCore.RetainCount (SwiftObject)}, Weak retain count {SwiftCore.WeakRetainCount (SwiftObject)}");
            //SwiftMarshal.Memory.Dump (SwiftObject, 128);
#endif
            SwiftObjectRegistry.Registry.Add(this);
            AllocCalled?.Invoke(null, new CapsuleTrackArgs(this));
        }