Add debug func. to check if wrappers alloc. mem. has been freed

Add a call to this function at the end of all tests, utils and
examples, and fixed a leak found in test_cad_profiler.