-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache loaded dom images on Image class so the playground-editor doesn't have to reload them often #13388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the data being disposed when the GUI is disposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this should be part of the Image class, could the cache be moved in the editor as it looks dedicated for it ?
@sebavan this behavior isn't totally exclusive to the editor, as this would happen in any case where the control is repeatedly cleared and added to the parent. For example, this Playground: https://playground.babylonjs.com/#F2SG3A#2 |
My only comment is caching to a static object without clearing it when the image/scene/engine disposes. Not sure what would be the best dispose mechanism here, but it should be cleared for sure when the engine is disposed (otherwise it is technically a memory leak). Is it possible to dispose the data when an image is disposed? |
@carolhmj, would this also remove the duplicated image requests for grass.png in this playground? https://playground.babylonjs.com/#XCPP9Y#16922 |
@kircher1 I tested and it does remove the duplication! I'm just going to move this to be a ADT level cache so it doesn't leak memory :) |
Visualization tests for webgl1 have failed. If some tests failed because the snapshots do not match, the report can be found at If tests were successful afterwards, this report might not be available anymore. |
ohhh yeah right, I wonder how often we actually set it after knowing it is a ctor parameter ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @sebavan - i'll let you merge it after your concerns are addressed.
This reverts commit ae8c525.
Without the change:


With the change: