How to detect a memory leak

I have read in several places about the dangers of memory leaks in standalone web apps that run continuously between power failures. How does one detect a memory leak and how does one deal with one it the cause cannot be found?

When I had a memory leak problem (not a web app however) I used ‘activity monitor’ on a mac and looked at the real memory usage for the application when it was running. In my case I was doing number crunching and had a long running loop that made the leak obvious (leaking 1-2 Mbytes per second). It took me several hours of pruning code to find the offending statement. In the end it was a Xojo bug and they fixed it pretty quickly. In this case it was a format statement that was leaking. The feedback for the problem they fixed is below for reference.