-
Notifications
You must be signed in to change notification settings - Fork 44
Memory leak if you create too many sublevels #38
Comments
sublevel#close() would be better, since it's analogous to what leveldb should do in that situation. would merge a pull request for this feature! |
Regarding hooks, I think it can be done in two parts in sublevel:
However, we can add a simple new method in level-hooks: Which one do you prefer? |
2 that is a great idea! way simpler! You should probably just match the string prefix rather than a regexp, but, whatever does the job. |
I'm for |
you could also write a LRU kind of plugin to auto close sublevels |
hmm, actually, I think that would work! |
you'd just have to check if there are any streams/hooks currently open to them. |
Without looking at the code, I'm wondering if sublevels need to be stored on the db at all? could they instead exist only as references returned from |
@timoxley sublevels arn't stored in the database (except for the data inside the sublevel, of course) So, I don't have a strong need for this feature my self, but I'll be happy to merge, |
Sublevels are never removed from the the global
db.sublevels
, thus if we create a lot of them (e.g. one for each user), we will leak memory.How about a
unsublevel
method that removes the named sublevel?This can be called when the users logout or similar.
The text was updated successfully, but these errors were encountered: