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

Components should Dropo once are destroyed #288

Closed
anga opened this issue Jun 18, 2018 · 4 comments
Closed

Components should Dropo once are destroyed #288

anga opened this issue Jun 18, 2018 · 4 comments

Comments

@anga
Copy link
Contributor

anga commented Jun 18, 2018

Description

I implemented Drop for a component, hoping that is going to be executed, once the component is destroyed, but it doesn't. I think component should drop once destroyed because the memory usage may increase a lot if you instantiate many components of the same time. And this is normal on a webapp that use, for example React.

Expected Results

Components should drop once are destroyed.

Actual Results

Components are never drop

Context (Environment)

Latest git code (0.5, hash bde3612) with Rust 1.27

  • target: wasm32-unknown-unknown
  • cargo-web: v0.6.10
@therustmonk
Copy link
Member

You could use Component::destroy method.
https://github.com/DenisKolodin/yew/blob/master/src/html.rs#L37
But it will be replaced with Drop in the future.

@anga
Copy link
Contributor Author

anga commented Jun 18, 2018

Sorry to do not clarify, yes, I did that, but destroy does not drop the object from memory. Anyway, good to know that is planned :)

@kjeremy
Copy link
Contributor

kjeremy commented Sep 6, 2018

@deniskolodin is there an outline of how one would make this happen?

@jstarry
Copy link
Member

jstarry commented Sep 27, 2019

I believe this is now fixed in 0.9 (#651) please re-open otherwise

@jstarry jstarry closed this as completed Sep 27, 2019
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

No branches or pull requests

4 participants