I edited my reply to include the additional subs.
grab_page() can sometimes fetch a humongous email thread. It is also called several hundreds of times a day at work.
A bit of background... Our search engine indexes the emails that we exchange with our clients. Doing so, it also generates a HTML version of each email. By querying the search engine with the support case number (I'm a support agent), I can get all the exchanges of a support ticket in the correct order. By fetching the HTML version and by extracting the first part of each email thread, I can reconstitute a perfect flow of communication. This is very useful when grabbing the case of another support agent for example.
After watching the video mentioned by Dave, it seems that all the memory used by those ajax calls will remain into malloc and not returned to the OS.
Am I missing something?