-
Notifications
You must be signed in to change notification settings - Fork 10
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
destroy the msg when dropping it, closes file descriptor #30
Conversation
While this works I was reluctant to do the same since I never fully understood the role of the "MessageOwner" in this code. I guessed the lifetime of said object defines the lifetime of (all) the message(s) associated with e.g. the related query? |
As far as i understood a query can only once be fetched, otherwise one would have to make a new query. Maybe someone here has more knowlege about notmuch's C side? |
Sidenote: I ran into the issue using notcoal to tag my mails. I haven't noticed any issues there with the patch applied |
from https://git.notmuchmail.org/git?p=notmuch;a=blob;f=lib/notmuch.h;hb=HEAD#l942 |
I think I may have stumbled over this once but I wasn't able to reproduce it. Makes sense because I don't think I index enough messages to run out of file descriptors particularly often. Apparently the lack of drop was explicitly mentioned here #3 but I'm not sure if it's still relevant. Either way, thanks for this, I'll push a bugfix release of notcoal when/if this gets resolved. |
Unfortunately, this has unintended side effects. Dropping a Message essentially invalidates it throughout the Query it is bound to. Meaning that, if you call |
I always expected search_messages to re-fetch all the messages. Thanks for noticing @vhdirk. |
Still, If you figure out a way to make this work, I'd be happy to integrate it. Lifetime management of notmuch is pretty hard :( |
What do you think about an The big downside is that this requires new types. |
I'm certainly not against it. I just don't have the time these days :) |
Did you get any further with this @foosinn? I like the |
Closing as supercow has been replaced with Rc's |
Calls
notmuch_message_destroy
upon dropping the message. This frees the memory and the filedescriptor.From the documentation:
This fixes file descriptor issues when querying a lot of messages and e.g. call header() on them.
fixes #27
Please note: I am not an experienced rust programmer, if there are any issues let me know.