-
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
Drop method exported from WASM + removing leaks. #6365
Conversation
Hej @farmaazon thank you for this. Unfortunately this solution requires wasm to be fully loaded and initialised which is not cloud case. Our current flow is: New dashboard reinitialise ensoglApp on project run, sets Let me know what time suits you best tomorrow for a call so we can check whats are our options :) |
But |
@PabloBuchu @wdanilo fyi, Adam is off tomorrow. |
@vitvakatu thanks a lot! In the meantime @PabloBuchu has written to me that this might be resolved. @PabloBuchu am I right here? |
can we merge this?who is doing QA here? |
not sure if it's out of scope for this PR, but |
First, it should be reviewed. I've got no accept from anyone. @wdanilo @MichaelMauderer can you review it? |
I'll review it in 1h! |
We're not creating it (it is hardcoded in the HTML), so I don't think we should remove it. |
oh sorry brainfart, i meant the scene element - otherwise the new scene element is hidden under the old one so it just looks blank |
app/gui/src/lib.rs
Outdated
let objects = objects.borrow(); | ||
if !objects.is_empty() { | ||
error!("Tracked objects leaked after dropping entire application!"); | ||
error!("{objects:#?}"); |
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.
Should this message be prefaced with some info? Maybe error!("Objects that go leaked: {objects:#?}");
|
||
|
||
|
||
// ==================== |
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.
Should this be in the prelude, or is there a better place for it closer to the executor or other memory management functionality?
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.
It needs to be available from many places, including both IDE controllers and view. Also, the executor I know is more about handling asynchronous tasks, not memory management.
I cannot think about any other package.
// === LeakDetector === | ||
// ==================== | ||
|
||
/// A module containing an utility for detecting leaks. |
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 was reading documentation of this module and the inner structs and I got the high-level overview, but there was no examples how this should be used and no explanation of how to use it. The constructor function documentation Create enabled structure with appointed entity name (shared between all copies).
is not helpful either - I mean, it creates an "enabled" structure with a shared name, but then what? I think I'd need a little bit more docs here.
Also, I don't see how it's used in the new code, but that's probably it is somehow connected to the existing TraceCopies
and I need some docs to understand it better.
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.
Create enabled structure with appointed entity name (shared between all copies). is not helpful either - I mean, it creates an "enabled" structure with a shared name, but then what? I think I'd need a little bit more docs here.
Well, then it does exactly what struct's documentation says:
- The underlying TraceCopies tracks copies, printing when they are created and dropped.
- Additionally, the existing copies are stored in [
TRACKED_OBJECTS
].
The documentation should be read withTraceCopies
thelead_detector::Trace
is a wrapper over it (and documentation says it).
What information do you still miss?
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.
Ok, I think adding a clear and explicit information that all the Traces
are stored in TRACKED_OBJECTS
when the leak detector is enabled is good enough, but I missed that from docs. Maybe someone else would find it obvious, but I don't. I'd be very thankful for adding a line with this explanation there.
QA Report 🟡@somebody1234 noted that the scene element is left when we drop the application. We're creating a bunch of elements, so we should probably remove them. I don't know if it's necessary for cloud needs. These elements are left after drop: Otherwise looks good. |
it's easy enough to remove on the cloud side - however i think here is the right place to handle it also note that all the other elements are children of the scene element so just removing the scene element should be enough |
@farmaazon are you able to add removing |
Already there. Unfortunately, I spent some time on it trying to discover more leaks. Wasn't successful, but applied a workaround. |
seems like ensogl is still running after the element is gone - re: after the element is gone, the same error message (zero size) has happened before when i set the |
Fixes #6317 The `drop` method is available in the WASM object. This can be tested by typing `ensoglApp.wasm.drop()` in the dev console - all objects should be removed and all connections closed. # Important Notes * This PR fixed serveral leaks by this occasion * A new tool for tracking leaks was added to prelude's `debug` module.
* develop: Passing events to sub-widgets in List Editor and refactoring of the slider component. (#6433) Revert "Cloud/desktop mode switcher (#6308)" (#6444) Widgets integrated with graph nodes (#6347) Table Visualization and display text changes. (#6382) Skip redundant compilations (#6436) Add parse extensions to Text type. #6330 (#6404) Cloud/desktop mode switcher (#6308) Replace Table should_equal with should_equal_verbose (#6405) Rollback event handling changes for the mouse (#6396) Dashboard directory interactivity (#6279) Ability to change the execution environment between design and live. (#6341) Implementation of elements adding to List Editor and a lot of internal API (#6390) Drop method exported from WASM + removing leaks. (#6365) Turn null into UnexpectedExpression when Union type is incomplete (#6415)
Pull Request Description
Fixes #6317
The
drop
method is available in the WASM object. This can be tested by typingensoglApp.wasm.drop()
in the dev console - all objects should be removed and all connections closed.Important Notes
debug
module.Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.