I've not looked at the source code, but ...
You could cache the file handle and only close it when the dir changes? You could simply save the path string and then compare it when the path is changed...
Anyway, this means the only way for me to deal with this is to close the directory EVERY time right after I open it. But it's not ideal for the design of this object, where I wanted it to leave the directory open so we could keep querying for files without the need to reopen it every time. I guess I can just deal with this by opening/closing all the time, but it kinda sucks... Unless the wizards out there have a magical way out for me :)
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/
Thanks Dan, I'll keep thinking about it. For now I made a quick fix so I could release an update of my library and tutorial (already out!)
cheers
Em sex, 8 de fev de 2019 às 19:32, Dan Wilcox danomatika@gmail.com escreveu:
I've not looked at the source code, but ...
You could cache the file handle and only close it when the dir changes? You could simply save the path string and then compare it when the path is changed...
Anyway, this means the only way for me to deal with this is to close the directory EVERY time right after I open it. But it's not ideal for the design of this object, where I wanted it to leave the directory open so we could keep querying for files without the need to reopen it every time. I guess I can just deal with this by opening/closing all the time, but it kinda sucks... Unless the wizards out there have a magical way out for me :)
Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com robotcowboy.com
On Fri, 2019-02-08 at 21:57 -0200, Alexandre Torres Porres wrote:
Thanks Dan, I'll keep thinking about it. For now I made a quick fix so I could release an update of my library and tutorial (already out!)
I don't see any leaking file handles anymore. Cool! Thanks for fixing.
Roman
On Sat, 2019-02-09 at 12:06 +0100, Roman Haefeli wrote:
On Fri, 2019-02-08 at 21:57 -0200, Alexandre Torres Porres wrote:
Thanks Dan, I'll keep thinking about it. For now I made a quick fix so I could release an update of my library and tutorial (already out!)
I don't see any leaking file handles anymore. Cool! Thanks for fixing.
I was wrong. [dir] is still leaking file handles, just the process to trigger it is a bit different. I had to use it in netpd to actually notice it (so, unfortunately no switch from ggee|moocow/reaadir to else yet). See:
https://github.com/porres/pd-else/issues/478
Roman