enum
UI::ReleaseStrategy
Overview
Describes how a NativeHandle should release its underlying platform pointer.
Each strategy maps to a specific platform memory management model:
-
ObjCRelease: The handle owns the pointer and will callobjc_releasewhen released. Use for ObjC objects that Crystal has retained (+1). -
ObjCBorrowed: The pointer is a borrowed reference from the ObjC runtime. Crystal does NOT own it and must NOT release it. Typical for class objects, method return values that are autoreleased, or pointers into parent containers. -
JNIGlobalRef: The pointer is a JNI global reference created viaNewGlobalRef. Must be freed withDeleteGlobalRefvia the JNI environment. -
Unowned: The pointer's lifetime is managed externally. The handle is a tag-only wrapper. No release action is taken. Used for stack-allocated values, pointers managed by another system, or testing with mock pointers.
Defined in:
ui/native/release_strategy.crEnum Members
-
ObjCRelease =
0 -
ObjCBorrowed =
1 -
JNIGlobalRef =
2 -
Unowned =
3
Instance Method Summary
-
#jni_global_ref?
Returns
trueif this enum value equalsJNIGlobalRef -
#obj_c_borrowed?
Returns
trueif this enum value equalsObjCBorrowed -
#obj_c_release?
Returns
trueif this enum value equalsObjCRelease -
#unowned?
Returns
trueif this enum value equalsUnowned