You should not use classes across the module boundary, this is not supported and can and will only lead to problems. And also you should not free memory that had been allocated in one module in another module unless you also use a shared memory manager.