So i want to find out ways to track memory usage of APIs/Functions in C++.
Example GetData(structObj, *classObj);
If GetData() is leaking memory, it can leak only via structObj and *classObj as they are the only memory we have provided to it.
I need to track what is happening to the memory of structObj and *classObj inside GetData();
I personally think implementing garbage collection in C++ in counter productive, I don't want to distract you from you from plans of doing it, but from my humble experience I've seen it done mostly by people inclined to managed languages, usually in bigger projects (ex. unreal engine)
Garbage collection IMHO only adds unnecessary bloat to code negating language benefits, as if smart pointers are not good enough to achieve the goal, and reduce the possibility of leaks.
Thomas1965, gave you good suggestion how to start it, overloading new/delete to track memory allocations.
Anyway I've never done it myself so I my be wrong on this, but would really like someone to tell me what are the benefits and some good reasons and why it should be done compared to normal means of managing memory?