-
Notifications
You must be signed in to change notification settings - Fork 326
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
No rendering after drop #6911
No rendering after drop #6911
Conversation
…dering-after-drop-6505 Merge remote-tracking branch 'origin/develop' into wip/procrat/no-rendering-after-drop-6505
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.
These changes look OK, but I'm missing info how this PR really works. Even if we are cloning world and scene in different places, all of these objects should get dropped if we drop the main app instance. Even if FRP closures keep reference to them, these networks should be dropped, so how this PR really fixes the mem leaks problems and more importantly, what is the guideline for future code to not create leaks? Also, are we able to create automated test for it?
@@ -400,6 +400,7 @@ fn entry_for_current_value( | |||
/// is minimal, as the actual dropdown view is not created. | |||
#[derive(Debug)] | |||
struct LazyDropdown { | |||
// Required for lazy initialization |
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.
dot missing
app/gui/view/graph-editor/src/lib.rs
Outdated
@@ -1802,6 +1805,7 @@ impl GraphEditorModelWithNetwork { | |||
#[allow(missing_docs)] // FIXME[everyone] Public-facing API should be documented. | |||
pub struct GraphEditorModel { | |||
pub display_object: display::object::Instance, | |||
// Required for dynamically creating nodes and edges |
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.
dot missing
@@ -66,6 +66,7 @@ pub type List<E> = ListData<E, <E as Entry>::Params>; | |||
#[derivative(Clone(bound = ""))] | |||
#[clone_ref(bound = "E:CloneRef")] | |||
pub struct ListData<E, P> { | |||
// Required for dynamically creating new entries |
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.
dot missing
@@ -89,6 +89,7 @@ impl component::Frp<Model> for Frp { | |||
/// Internal model of the SequenceDiagram. | |||
#[derive(Clone, CloneRef, Debug)] | |||
pub struct Model { | |||
// Required for dynamically creating new lines |
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.
missing dot
There were two causes I'm aware of
Removing clones was rather for reducing noise when debugging (the reports said about 1500+ references to App), and I think removing reference which is not needed is a good idea anyway. How to mitigate it? Here we have another example of FRP network taking itself. Almost all leaks I encounter in our codebase are like that. I think the FRP could be changed a bit, to make clear that FRP should own the model (maybe special "model" behavior node, which gives mutable references to Model? |
…dering-after-drop-6505
QA 🟡 This looks mostly good, there are no errors after dropping the app. But when I press tab with focus in the empty window, I see the following error:
Could this indicate there is still some Enso event handling active? @farmaazon |
Both yes and no: it means that the closure was dropped in rust successfully, but JS still had reference to it. See https://rustwasm.github.io/wasm-bindgen/api/wasm_bindgen/closure/struct.Closure.html Tracking the offending closure may be tricky, but I'll try to find it.
|
Added more serious tracking of
I still don't know why only |
Because the problems are not actually regressions (there were before this PR) and this PR improves things, I will merge it, but won't close the task #6505. |
Description
There were various memory leaks which caused the scene to stay around which tries to render after the GUI has been dropped.
There were 1500+ leaked objects. The first few commits by @Procrat tackle the actual leaks. The last commit of him tries to reduce the cloning of
Application
across the codebase, so debugging leaking references will be easier. @farmaazon then added fixes for last leaks and cleaned up the code.Additionally, the message about visualization failing to attach is displayed in pop-up instead of status bar, so it will disappear after some time. Fixes #6976
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
[ ] Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.