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 :) 

I could also try and see how other Pd objects deal with this... I'm using [dir] to remove my dependency of [playlist], haven't tested how it'd behave in this situation, probably fine. I have tested [hcs/folder_list] though, it does this sort of thing and doesn't seem to crash!

Well, let me go ahead and sort this out, thanks a lot for your help!

cheers

Em sex, 8 de fev de 2019 às 15:59, Alexandre Torres Porres <porres@gmail.com> escreveu:
Em sex, 8 de fev de 2019 às 13:55, Alexandre Torres Porres <porres@gmail.com> escreveu:

https://github.com/porres/pd-else/blob/9b259f24569a13069c5842ec0f598e8fe96c8cbc/Classes/Source/dir.c#L75

the leak seems to be on this line.  you should keep the return value of
opendir and be sure to close it when no longer necessary.

Well, I'll take there must be a leak or something there, but I'm calling this method (dir_open) in the patch. This object opens directories so we query for filenames in it, and for that it depends on <dirent.h>. And the thing is that if there are too many opened directories, crap happens. I've tried everything already, but it seems to be an issue with the opendir() function in dirent.h

See http://pubs.opengroup.org/onlinepubs/7908799/xsh/opendir.html where it says "applications will only be able to open up to a total of {OPEN_MAX} files and directories", that might be it. Also, the given errirs in that page mention "descriptors" and how "Too many files are currently open in the system".


Em sex, 8 de fev de 2019 às 07:58, Roman Haefeli <reduzent@gmail.com> escreveu:
Maybe you closed them, despite them not being fixed.

I may have closed yours because it was a duplicate issue, also reported/discussed here https://github.com/porres/pd-else/issues/248 by Liam.

cheers