Fix the memory leak related with the TRef objects table (fix #156)

This MR fix the memory leak spotted in the issue #156 (closed). Please see details there.

I implemented the count/reset mechanism in the ModuleManager::run method, but I am not fully sure if there is the proper place (I could be missing something, I'm not an expert on the framework).

Merge request reports