'Is it possible to track number of created objects and allocated memory by method on Android?

I need to get allocated memory size and created object count by a specific method in my Android project. I tried using Android Stuido Profiler tool, but I cant quite get the results for a specific method call. Is it even possibe? What would be the best way to do it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source