Bill Roper (billroper) wrote,
Bill Roper

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

  • The Colder Side of Spring

    It was supposed to be getting warmer for Spring, but the weather appears to have other ideas this week. There's a freeze warning tonight, so I went…

  • Out to Lunch

    Gretchen and I were casting about for something different to have for lunch today. I have been craving a good smoked brisket sandwich and my Internet…

  • Bits and Pieces

    Got up early today for softball practice. The second half was a scrimmage with one of the other local teams, which was a good learning experience for…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded