Hacker News new | ask | show | jobs
by maushu 5280 days ago
What? I'm sorry, but what? The point of profilers is to find memory leaks and performance bottlenecks while disregarding the performance of the app with the profiler running.

Who cares if the profiler is making the app run slower. You aren't going to run it all the time in production!

If you can't find the memory leak or performance bottleneck, either you are doing something wrong or the profiler is not giving enough information. Getting a stack trace of where those byte[]'s are being created would be a good start.

3 comments

This was my thought as well. While memory profilers tend to be fairly useless in my experience, disregarding them simply because they degrade the performance of your application (and really, 3-4x in the case of YourKit is astoundingly good) is silly. Heavy use of a debugger will also degrade the performance of your application -- should we not use debuggers, even when they're the right tool for the job?
memory profilers tend to be fairly useless

In my own experience I've had quite a bit of success with the valgrind family of tools when I was debugging memory leaks in a GSM message codec (written in C, not a managed language) I wrote a few years ago. I guess it depends on the nature of the code and memory leaks.

I've also had some success tracing memory use with VisualVM for the purpose of finding out where memory is allocated so it could be used more efficiently (both for performance and do prevent leaks).

You don't even need a stack trace per se, the profiler should show you where everything is rooted in memory, or you should at least be able to track it back item-by-item to see where they are being held for enough instances to get a general picture of where memory consumption is occurring.
Profiler will not show you any memory roots. No one profiler. Memory dump analyzer will.
You cannot run it in production at all. No product owner will tolerate such overhead. And if you cannot run it in production long enough, then how and when will you find your memory leak?