December 9th, 2004

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...

I'm Thinking. I'm Thinking.

Over lunch today, I ducked over to the Guitar Works and looked at several expensive guitars, trying to decide if they're good enough -- or I'm good enough -- to notice the difference between them and my Taylor 710 cedar top.

I don't know. But they sure do sound pretty. And Terry's offered to let me take them home and try recording with them to see if they sound better on tape than my current selection of instruments.

There are advantages to having been a customer for 20 years. :)