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

garbage collection #20

Closed
yegor256 opened this issue Oct 31, 2022 · 4 comments
Closed

garbage collection #20

yegor256 opened this issue Oct 31, 2022 · 4 comments

Comments

@yegor256
Copy link
Member

Right after a call of Sodg.data() function, the vertex must be sent to garbage collection, which may or may not delete the vertex. If there are no edges arriving to the vertex -- it may be deleted. If a vertex is deleted, all vertices that are connected to it through edges that depart from it -- must be placed into garbage collection pipeline.

We shouldn't do this in a parallel thread. Everything should be done synchronously.

@UARTman
Copy link
Contributor

UARTman commented Nov 23, 2022

@yegor256 I think I should probably begin working on this. I'll first implement the prototype that does only what you've outlined and then we'll need to discuss the larger context: how will GC (and Sodg itself) be used in the context of the language.

@UARTman
Copy link
Contributor

UARTman commented Nov 26, 2022

@yegor256 Okay, now that I've started to implements the GC, we need some way to track arriving edges (aka parents). Since we don't currently have it, I'll have to implement it.

I'll just add a set of u32s to each Vertex and update the sets each time we bind them. This should work, at least for now, but there will probably be a number of problems when, say, deleting the vertices.

However, at some point we should definitely look at how to store graphs in memory in a more optimal way.

@UARTman
Copy link
Contributor

UARTman commented Nov 30, 2022

@yegor256 A quick update: I've implemented the basic gc functionality, all that remains are tests. However, I've broken two tests: prohibits_orphan_edges and prohibits_labels_of_broken_format. They now fail because Sodg::bind now errors on v2 not being present, which in turns is caused by the need to update the arrived at vertex for the parent tracking.

UARTman added a commit to UARTman/sodg that referenced this issue Dec 5, 2022
UARTman added a commit to UARTman/sodg that referenced this issue Dec 13, 2022
- Make `Sodg::collect` `pub(crate)` instead of `pub`.
- Remove `peek_data` as it isn't needed
UARTman added a commit to UARTman/sodg that referenced this issue Dec 19, 2022
UARTman added a commit to UARTman/sodg that referenced this issue Jan 6, 2023
UARTman added a commit to UARTman/sodg that referenced this issue Jan 6, 2023
@yegor256
Copy link
Member Author

yegor256 commented Jan 9, 2023

@UARTman this seems to be fixed, thanks!

@yegor256 yegor256 closed this as completed Jan 9, 2023
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

2 participants