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

Metadata decoding complex and leaks memory #2431

Closed
jeromekelleher opened this issue Jul 22, 2022 · 5 comments
Closed

Metadata decoding complex and leaks memory #2431

jeromekelleher opened this issue Jul 22, 2022 · 5 comments

Comments

@jeromekelleher
Copy link
Member

As observed in #2428, and directly here:

#2428 (comment)_

jeromekelleher added a commit to jeromekelleher/tskit that referenced this issue Jul 22, 2022
@jeromekelleher
Copy link
Member Author

jeromekelleher commented Jul 22, 2022

In #2432 I've made a pass at solving this by making metadata decoding fully "eager", (instead of lazy). Specifically, this decodes the metadata when an object (row or entity) is created, rather than when the .metadata attribute is accessed. This works and does simplify the code a lot, but it may be a step too far in terms of changing the current behaviour.

I've had another go at tweaking things, but there's a complicated web of semi-conflicting requirements that it's very hard to disentangle. We're treating XTableRow and the entity X classes in the same way as dataclasses. These have both the metadata attribute, but that's somehow accessed dynamically behind the scenes. Some of the dataclasses are specified as frozen, and some aren't.

Any thoughts here @benjeffery? Can we simplify the design a bit here, or should we just try to get to the bottom of the circular references problem in #2428?

@jeromekelleher jeromekelleher changed the title Metadata decoding overly complex and leaks memory Metadata decoding complex and leaks memory Jul 22, 2022
@jeromekelleher
Copy link
Member Author

Decoding leak fixed in #2439

We should still probably discuss the possibility of simplifying things a bit.

@benjeffery
Copy link
Member

I think with #2441 and #2439 I think we can close this? The metadata decoding is still complex due to needing the decoding to be lazy in a dataclass, but there the perf tradeoff is more than worth it.

@jeromekelleher
Copy link
Member Author

Yeah, agreed. Be nice to get some data on the perf tradeoffs here, but lets close.

@benjeffery
Copy link
Member

Yeah, agreed. Be nice to get some data on the perf tradeoffs here, but lets close.

We'll get this in #2444

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