#WeakReference
get! get! get! get! get!!! #Java25
August 7, 2025 at 1:08 AM
(engine dev thinky stuff) Trying to think of a reason I shouldn't have an asset cache that gives out strong refs to loaded assets, but itself only stores a WeakReference (so that if nothing references a given asset it can just be garbage collected automatically...)

🤔
December 3, 2025 at 1:13 AM
Es gibt WeakReference in PHP. 😭
2/2 … PHP-Arrays werden entsprechend aktualisiert.

Dann habe ich Interfaces und Traits für Retainables, Nodes und Node Data. Das ermöglicht Trees, wo die einzelnen Nodes auf ihren Supernode aka Parent Node verweisen können, ohne Circular References, die von PHPs Garbage Collector aufgebrochen … 2/3
July 20, 2024 at 11:54 AM
The other thing I loved back then was after loading before gameplay started I would do (and I forget the exact type names here, sorry)

WeakReference gcTracker; // member of the renderer, I think?

gcTracker = new object()

And before every present if it was null, I cleared to purple and remade it
December 9, 2025 at 4:52 AM
How would you write a test to verify that a WeakReference implementation actually does free its memory at some point?
August 7, 2025 at 7:50 PM
this approach could lead to a memory leak! If the view or Activity is destroyed while the Runnable is still posted and holding a reference to it, a memory leak can occur. You might need to clean up on this Runnable or wrap the reference in a WeakReference 🤙
September 18, 2024 at 8:13 PM
Is your WeakReference implementation manually managing its memory?

Could you instrument the pieces of code which deals with deallocating memory, perhaps providing a hook (possibly only used within tests)?
August 7, 2025 at 10:27 PM
長年プログラマやっておきながら、強参照・弱参照の名前だけ知っていたけど、今更フワッと内容抑えれた。今更すぎる。

[Java] WeakReferenceとその仲間たち
qiita.com/yoshi389111/...
[Java] WeakReferenceとその仲間たち - Qiita
目的何度読んでも意味が分からない java.lang.ref パッケージを、忘れないように(あるいは忘れても良いように)メモ結論SoftReference はキャッシュ用(あまり使い勝手は良く…
qiita.com
February 28, 2025 at 11:55 PM
But yeah, my trick was to have, in my renderer (and it's been a minute so ignore that the syntax is all wrong)

WeakReference gcWatcher = new object();

and before present, if gcWatcher was null, I cleared the screen to purple and re-created it so I could visually see the GC happening
November 13, 2025 at 9:08 PM
> "Efficient memory usage"
> Look inside
> WeakReference<T>
June 2, 2025 at 9:35 PM
May 2, 2025 at 1:36 AM
Csharp glue crash? How do I fix this...
### Godot Version 4.4 rc2 ### Question I’m getting a crash like this in my game: ERROR: Unhandled exception System.ArgumentException: Godot Object not registered. (Parameter 'weakReferenceToSelf') at Godot.DisposablesTracker.UnregisterGodotObject(GodotObject godotObject, WeakReference`1 weakReferenceToSelf) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs:line 85 at Godot.GodotObject.Dispose(Boolean disposing) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:line 150 at Godot.GodotObject.Finalize() in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:line 100 at: void Godot.NativeInterop.ExceptionUtils.LogUnhandledException(System.Exception) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:132) Unhandled exception. System.ArgumentException: Godot Object not registered. (Parameter 'weakReferenceToSelf') at Godot.DisposablesTracker.UnregisterGodotObject(GodotObject godotObject, WeakReference`1 weakReferenceToSelf) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/DisposablesTracker.cs:line 85 at Godot.GodotObject.Dispose(Boolean disposing) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:line 150 at Godot.GodotObject.Finalize() in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotObject.base.cs:line 100 It happens at a point in my code where I’m cloning a complex graph of objects using FastCloner library. How do I fix this? I’ve tried a couple of other deepcloning libraries, but this was the only one that fit my needs.
forum.godotengine.org
February 28, 2025 at 8:41 AM