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

Decouple clock number from size of history (Max history depth) #37

Open
Freddo3000 opened this issue Jul 21, 2023 · 4 comments
Open

Decouple clock number from size of history (Max history depth) #37

Freddo3000 opened this issue Jul 21, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Freddo3000
Copy link
Collaborator

Having clock number tied to history causes issues on higher clock numbers, as it is effectively a memory leak. It would be better to keep it separate, and add a limit to how large the history size can grow before it starts discarding the oldest records. I also suggest that instead of clock being stored in GuiData it is instead fetched when needed from the simulator.

@Freddo3000 Freddo3000 added the enhancement New feature or request label Jul 21, 2023
@perlindgren
Copy link
Owner

The reason to have clock in GuiData is that it provides a lens, so when changed components like the ProbeEdit knows that something has happened.

Regarding memory leak, I don't quite follow.

@Freddo3000
Copy link
Collaborator Author

Regarding memory leak, I don't quite follow.

I mean that keeping an unlimited sized history might not be optimal, as it might cause issues if you for example leave the clock running in the background and forget about it, as it will endlessly grow.

@perlindgren
Copy link
Owner

Indeed, the simulator holds the history (as a Vec<...), it would be perfectly possible to limit the size and have it dropping oldest element, on enqueing a new. Maybe a double linked version would be better with cheap operations on both head and tail.

@perlindgren
Copy link
Owner

perlindgren commented Jul 21, 2023

Components (and GUI elements) that holds internal state etc., is responsible for their own history management, essentially triggered by clock, un_clock and perhaps also reset (currently not implemented though).

@onsdagens onsdagens changed the title Decouple clock number from size of history Decouple clock number from size of history (Max history depth) Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants