Every SKObject produces an additional locker Object in heap. Can we fix this? #3266
Mikolaytis
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm seeing 1 million of empty objects on a heap in a stress scenarios of our app.
My goal is to reduce memory pressure.
I've found that 99.9% of these empty objects is actually not a casual boxing as expected, but lock objects in SKObject.
Because this object is used only in a single scenario that can fire only twice per object I think we can remove it and use lock(this). I know this is not the way we need to use the lock pattern and know what it can produce, but in this special case I think this is worth it.
Another solution I see is to make this object static and [ThreadStatic].
@mattleibow what do you think?
Beta Was this translation helpful? Give feedback.
All reactions