locked
IIS, ASP & COM object memory management RRS feed

  • Question

  • User1738978907 posted
    Hello all,

    I'm developing a set of COM components which, in general, work fine, except when run from ASP. I use a language other than Visual Basic and C++, but for the purpose of this discussion let's say that it's C compatible.

    My objects are created and destroyed on a page scope.

    The problem: methods which return or use bstrings (standard Basic strings) run fine for the first time, but the same page gets stuck during the second time (perhaps the hang occurs already on CreateObject stage).

    I found an (ugly) workaround - use Session.Abandon, and then the subsequent calls work, too. But when two clients are connected at the same time, it gets stuck again.

    From the search it looks like there is a memory leak somewhere. I suppose when I run a VBS on a desktop it also happens, but nobody gets affected. I can somehow relate to the case when a bstring is being returned, because my component needs to allocate memory; but I don't understand what's the problem with IN parameters.

    Could the respected gurus please enlighten how ASP allocates and de-allocates memory for bstrings? Do I need to catch the stray bstrings I allocated before my object gets destroyed, and handle them myself?

    Also, another question: is it safe to change the working directory (Win32 API SetCurrentDirectory call) from the COM object, and then change it back before the exit?
    Wednesday, June 13, 2007 2:49 AM

Answers

All replies