You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4176951
Browse filesBrowse the repository at this point in the historyBrowse files
[NSObject] Store the super handle in a ConditionalWeakTable. (#25454)
Store the super handle in a ConditionalWeakTable.
* Allocate native memory for it.
* Cache that native memory in a ConditionalWeakTable.
* Free it when the NSObject is freed (but not before).
* Obsolete the SuperHandle property in .NET 11, and remove it in XAMCORE_5_0.
This is less performant, but any performance issues will be alleviated by
the fact that NSObject.GetSuper () will be called much less after #25376.
The great advantage is that NSObjectData is now smaller, and fits in the
tagged memory returned by `ObjectiveCMarshal.CreateReferenceTrackingHandle`,
which will simplify memory management _a lot_ for CoreCLR.
Contributes towards #25383.
This is a continuation/simplification of #25405.
// The NSObject instance isn't gone yet, we have to try again later.
162
165
GC.ReRegisterForFinalize(this);
163
166
return;
164
167
}
165
168
166
-
NativeMemory.Free(data);
167
-
data=null;
169
+
unsafe{
170
+
NativeMemory.Free((void*)Value);
171
+
}
172
+
Value=IntPtr.Zero;
168
173
169
174
if(handleAllocated)
170
175
handle.Free();
@@ -208,6 +213,10 @@ public partial class NSObject : INativeObject
208
213
// having to attach those threads to to the managed runtime.
209
214
IntPtr/* unsafe NSObjectData* */__data;// Read directly from several places in the runtime
210
215
216
+
#pragma warning disable CS8618// "Non-nullable field '...' must contain a non-null value when exiting constructor.": this field is always non-null, because NSObject.Initialize is called before anything else is done.
0 commit comments