Bill Roper (billroper) wrote,
Bill Roper

The Dam Has Burst! Run For Your Lives!

It appears that we have a big memory leak in our application. Some of it is my fault, because I copied incorrectly working code without bothering to check how a particular class worked.

Short form: our COM routines return a BSTR. If you assign that BSTR value to an object of the CComBSTR class, the value is copied to the internal storage for the class instead of being attached to the internal storage. So if you were counting on the BSTR being cleaned up when the CComBSTR object went out of scope, well, you were right for one out of two strings.


The solution is to call the Attach method for the CComBSTR class so that it takes ownership of the pointer.

And happily, I figured this out before code freeze.

Now we just need to fix all of the places that are doing it wrong.
Tags: microsoft, musings, work

  • Paying It Off

    I checked tonight and I do indeed have two more months to pay my property tax without incurring late fees. So I guess I'll be paying that later. The…

  • Jean, Jean

    I am trying to buy a new pair of jeans. Normally, this would be simple. Go to Amazon and order a pair of Levi's 560s in my size. Except that Levi has…

  • Ice, Ice, Baby

    Much of today could have been sold for scrap, but there was some progress on the refrigerator front. After decanting the contents of the fridge and…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded