Skip to content
This repository has been archived by the owner on Nov 12, 2019. It is now read-only.

Memory disposal #17

Open
Raynos opened this issue Jan 17, 2013 · 7 comments
Open

Memory disposal #17

Raynos opened this issue Jan 17, 2013 · 7 comments

Comments

@Raynos
Copy link
Contributor

Raynos commented Jan 17, 2013

Should crdt listen to the dispose event and purge it's history / memory when it occurs.

How else would I say doc.destroy() to indicate the document is no longer necessary and I want to release the memory.

@dominictarr
Copy link
Owner

dispose kills all the streams, so there won't be external references to it...
there should never be references coming from the objects in history to anything else (or vice versa)
so once the streams are disconnected, it should get GCed.

@Raynos
Copy link
Contributor Author

Raynos commented Jan 18, 2013

@dominictarr that assumes all references to Row's are GC'd. That's a big assumption.

@dominictarr
Copy link
Owner

hmm, okay, so maybe we want to call removeAllListeners() after next tick on all the rows and sets.
history doesn't contain references to any Row, just the ids of the rows they pertain to.

@Raynos
Copy link
Contributor Author

Raynos commented Jan 18, 2013

or! loop all rows null out .state. null out .sets and .hist null out ._events done!

@dominictarr
Copy link
Owner

that is messy! I want a test for this. As I said, you don't need to null hist, because there will be no references to it.

You'll need to find some documentation on triggering GC in javascript, or some sort of test case,
I guess using weak-map, if you want to convince me this is a good idea.

@Raynos
Copy link
Contributor Author

Raynos commented Jan 18, 2013

@dominictarr I don't want to rely on GC nor my ability to not leak memory with closures when using scuttlebutt on the server. I just want to nuke old docs that are no longer relevant

@dominictarr
Copy link
Owner

Well, you are welcome to do that, but I am not bringing code into crdt unless it can be demonstrated to work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants