You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Mono/C#: Optimize the way we store GC handles for scripts
Don't store GC handles for C# script instances and instance bindings as 'Ref<MonoGCHandle>'; store the raw data instead. Initially this was not possible as we needed to store a Variant, but this had not been the case for a looong time yet the stored type was never updated.
This commit is contained in:
@@ -186,7 +186,7 @@ void CachedData::clear_godot_api_cache() {
|
||||
|
||||
// End of MarshalUtils methods
|
||||
|
||||
task_scheduler_handle = Ref<MonoGCHandle>();
|
||||
task_scheduler_handle = Ref<MonoGCHandleRef>();
|
||||
}
|
||||
|
||||
#define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_core_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class))
|
||||
@@ -316,7 +316,7 @@ void update_godot_api_cache() {
|
||||
// TODO Move to CSharpLanguage::init() and do handle disposal
|
||||
MonoObject *task_scheduler = mono_object_new(mono_domain_get(), GODOT_API_CLASS(GodotTaskScheduler)->get_mono_ptr());
|
||||
GDMonoUtils::runtime_object_init(task_scheduler, GODOT_API_CLASS(GodotTaskScheduler));
|
||||
cached_data.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler);
|
||||
cached_data.task_scheduler_handle = MonoGCHandleRef::create_strong(task_scheduler);
|
||||
|
||||
cached_data.godot_api_cache_updated = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user