Skip to content
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

Clearing operation stack when a new project is loaded #18883

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

saumyaj3
Copy link
Contributor

@saumyaj3 saumyaj3 marked this pull request as draft April 12, 2024 13:25
saumyaj3 and others added 3 commits April 12, 2024 15:28
This update refines the cleanup process across different parts of the application. Node reset functionality has been introduced which thoroughly cleans up the memory. Clear functions within SettingOverrideDecorator, SceneNodeDecorator, ConvexHullDecorator and others are improved to completely cleanse after usage. This approach ensures a more efficient use and management of memory resources.

CURA-11658
@saumyaj3 saumyaj3 marked this pull request as ready for review April 17, 2024 07:54
Copy link
Contributor

@wawanbreton wawanbreton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit afraid that this change can create crashes in Cura. Those variables may be expected to be non-Null when calling some methods on the objects, and the objects are actually still referenced and callable. I would go for only clearing the references that actually hold a lot of memory (mesh data) and don't touch the rest.

cura/Settings/SettingOverrideDecorator.py Outdated Show resolved Hide resolved
saumyaj3 and others added 3 commits April 22, 2024 15:07
The "clear" method has been renamed to "clearDecoratorData" to improve clarity on its function in several classes. This change affects the SettingOverrideDecorator, SceneNodeDecorator, ConvexHullDecorator, and SceneNode classes.

CURA-11658
Copy link
Contributor

@wawanbreton wawanbreton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still afraid of potentional crashes, e.g. when setting self._global_stack to None, this object is being called in every method without a check 😬 but I let you be the final judge of this. Or maybe have a second opinion from @nallath ?

@@ -2281,8 +2281,8 @@ def appHeight(self) -> int:
return 0

@pyqtSlot()
def deleteAll(self, only_selectable: bool = True) -> None:
super().deleteAll(only_selectable = only_selectable)
def deleteAll(self, only_selectable: bool = True, clear_all:bool = False) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def deleteAll(self, only_selectable: bool = True, clear_all:bool = False) -> None:
def deleteAll(self, only_selectable: bool = True, clear_all:bool = False) -> None:

We should guard against bool traps here. You can do that by by adding a param that eats up all unnamed arguments.

@nallath
Copy link
Member

nallath commented Apr 30, 2024

I'm not quite sure how this would even prevent the memory that much?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants