Reputation: 801
In this Flambe guide it says:
"This dispose function removes this component from its owning entity. You should override the dispose-function in order to dispose objects yourself, to prevent memory leaks."
I have 3 questions:
How should I override the dispose function?
How to properly use the dispose function?
Is there a way to check for memory leaks in Flambe?
Upvotes: 1
Views: 134
Reputation: 10143
1 If you're using Component
override public function dispose() {
myReferences = null;
myDisposable.dispose();
super.dispose();
}
If you are not using a Component
:
You can implement Disposable
and dispose when needed in another dispose function.
2 You need to clear references to objects, that means set it to null.
You need to close signal connections that are created in that context.
You need to dispose the Disposable
s.
3 If you use the JavaScript (html) target, you can use the chrome debug inspector / devtools. You can collect memory profiles, observe the cpu usage etc. Really useful! https://developer.chrome.com/devtools/docs/profiles
Upvotes: 1