Bill Roper (billroper) wrote,
Bill Roper
billroper

Please Remember to Close the Door

As you saw yesterday, we've been concerned about the virtual memory hole in our Server. It's not a leak, because the memory was eventually being cleaned up when you closed the Server, but the memory was being stuffed into a side pocket until then and not let loose. This was a Bad Thing (TM).

Bob, the new boss, has been running memory tests with BoundsChecker and had noticed that a particular function was opening a number of documents that weren't being closed. My initial assumption was that this was because of a failure in reference counting the document that was preventing the destructor from being called, so I dropped a bunch of TRACE statements into the code so I could watch files opening, closing, and being destroyed.

At the end of the run, I closed the Server normally and 33 unnamed (presumably temporary) files were closed. *ick*

So we went and looked at the function that Bob had located. It turned out that the function opened a temporary document and never asked for it to be closed. However, the document was being correctly registered with the document template, so when the application was closed, it was found and killed.

I added a bunch of try/catch logic to make sure that the document died on schedule. And things appear to be better now.

Apparently, though, my first assumption should have been that the person who wrote the code would forget to close the document. Not an assumption I like to make, but it would have saved some time...
Tags: musings, work
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments