Open guozirui33 opened 1 week ago
Hey @guozirui33 👋
The env is kept in memory so that if you try to open it multiple times in multiple threads, it opens it only once. Opening the same env multiple times in a program is disallowed with LMDB.
So, yeah, using the prepare_for_closing
and waiting for it is the way to go. That's the only way when you share the env across threads by using an Arc
internally.
Have a nice day 🌞
Hello! What is the recommended way to close an env such that all file handles are properly closed/deleted?
I was running some benchmarks involving heed and ran into "too many open files". So after some digging, I distilled my code down to this test:
Much to my surprise, this test fails!
I know I can work around this by calling
env.prepare_for_closing().wait();
instead ofdrop(env)
.However, just to make sure I understood the library correctly, is
drop(env)
not supposed to close file handles? Or is this potentially a bug?Thanks!