It is always a good idea to clear used resources explicitly if they are expensive just like you close database connection. Destructor will be called, maybe you just haven't released after enif_make_resource? It is a very common caveat.