stride icon indicating copy to clipboard operation
stride copied to clipboard

Editor Scene Hierarchy Memory Leak

Open IXLLEGACYIXL opened this issue 1 year ago • 8 comments

Release Type: Official Release/GitHub (please choose appropriate option) 4.2

Describe the bug The Editor has a memory leak in the assethierarchy or something that is connected to it

To Reproduce Steps to reproduce the behavior:

  1. new standard project
  2. watch at your mb used ( around 300 )
  3. click through the scene hierarchy, order doesnt matter, just click on items in the scene hierarchy in random order
  4. swapping 4 times the item in the hierarchy , the usage goes up by 12mb and stays at that level

Expected behavior The memory usage shouldnt just increase by clicking in the scene hierarchy

Screenshots grafik grafik

IXLLEGACYIXL avatar May 23 '24 05:05 IXLLEGACYIXL

This image shows some of the instances retained after selecting two different assets: image AssetRootNodePresenter seems like a good start, it likely is rooted somewhere and prevents its references from being collected. Here are the root paths for one of the two retained AssetRootNodePresenter: image So, all of the links to the node at the top should have released their reference to it but haven't for some reason. I don't have time to look into it further than this right now, so I'll leave it for now

Eideren avatar May 23 '24 15:05 Eideren

We have a previous/next system (based upon the undo/redo stack) which records selection of items in asset view or in scene hierarchy, so it is expected to have slight increase in memory when changing selection.

Kryptos-FR avatar May 30 '24 13:05 Kryptos-FR

the memory increasse is 6-7mb per click in the hierarchy, i didnt click often to reach 1gb of memory

it would make more sense to release the UI on click and on undo go back to the previous UI and build the UI again overall in gamestudio its a problem that nothing is getting released

IXLLEGACYIXL avatar May 30 '24 13:05 IXLLEGACYIXL

it would make more sense to release the UI on click and on undo go back to the previous UI and build the UI again

I have no idea what you mean by that.

Kryptos-FR avatar May 30 '24 13:05 Kryptos-FR

lets say the method exists "BuildUiOnHierarchyClick"

currently you click, BuildUiOnHierarchyClick(target) runs, you click again, the UI gets stored in the undo command

instead of storing the entire UI in the UI command you can just store BuildUiOnHierarchyClick(previousTarget) , so if you undo you build the previous UI again, instead of storing the entire UI

IXLLEGACYIXL avatar May 30 '24 14:05 IXLLEGACYIXL

There is no such thing, that's not how the undo/redo system works. It doesn't store anything related to UI.

Kryptos-FR avatar May 30 '24 14:05 Kryptos-FR

With that said, the leaks are likely not in the scene editor itself but on the property grid (and/or quantum nodes). I can reproduce an increase in memory by switching between selecting a Scene asset and the GameSettings asset in the asset view.

Kryptos-FR avatar May 30 '24 14:05 Kryptos-FR

With that said, the leaks are likely not in the scene editor itself but on the property grid (and/or quantum nodes). I can reproduce an increase in memory by switching between selecting a Scene asset and the GameSettings asset in the asset view.

a slight increase would be reasonable but 7mb per click is a little bit too much

IXLLEGACYIXL avatar May 30 '24 14:05 IXLLEGACYIXL