I\'m using opendir function to check if a directory exists. The problem is that I\'m using it on a massive loop and it\'s inflating the ram used by my app.
It sounds like you have a memory leak. Calling opendir should not inflate the RAM of your app as long as you remember to always call closedir after successfully opening a directory. Also, make sure you are freeing any buffers you allocated to compute the directory name.