ATL / IIS / EXE ???
-
howdy all- My current problem: I've got this ISAPI DLL, which does some stuff and generates XML. It's written in C++, uses MSXML3, and run's inside DLLHOST... Oh, and it leaks memory. (1) Is there a good way to debug this? (2) If I could convert this to a stand-alone exe, I could attach a debug memory manager.... Can this be done -- can I make an ATL/IIS server extension which is also an exe. (is this what's called an out-of-process server?) Thanks in advance! Regards -peter P.S. I think I do ask some of the more esoteric questions on this site.... I hope someone has some help or direction for me. Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
-
howdy all- My current problem: I've got this ISAPI DLL, which does some stuff and generates XML. It's written in C++, uses MSXML3, and run's inside DLLHOST... Oh, and it leaks memory. (1) Is there a good way to debug this? (2) If I could convert this to a stand-alone exe, I could attach a debug memory manager.... Can this be done -- can I make an ATL/IIS server extension which is also an exe. (is this what's called an out-of-process server?) Thanks in advance! Regards -peter P.S. I think I do ask some of the more esoteric questions on this site.... I hope someone has some help or direction for me. Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
Compile a debug version of your DLL and attach your debugger to DLLHOST.exe. Debug as usual.
-
Compile a debug version of your DLL and attach your debugger to DLLHOST.exe. Debug as usual.
oh... I wish it were that simple.... But tracking memory leaks is the real problem... and it's not MFC....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
-
oh... I wish it were that simple.... But tracking memory leaks is the real problem... and it's not MFC....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
I'm not sure I understand what your getting at. You asked "Is there a good way to debug this?". I explained how to do this. Why is it any different to track memory leaks in a dll? What does MFC have to do with anything?
-
I'm not sure I understand what your getting at. You asked "Is there a good way to debug this?". I explained how to do this. Why is it any different to track memory leaks in a dll? What does MFC have to do with anything?
Forgive me for my ignorance in this arena. It's code that was kinda thrown at me, and finally given all responsibility to figure out. I'll be more specific. It's an ISAPI DLL which mines data out of our servers, generates some XML and passes it back to IIS for display. Upon repeated use, it leaks memory... My attempts to locate the memory leak are failing, and i am flailing :) Maybe you could tell me the best way to detect memory leaks in a situation like this? Thanks -peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
-
Forgive me for my ignorance in this arena. It's code that was kinda thrown at me, and finally given all responsibility to figure out. I'll be more specific. It's an ISAPI DLL which mines data out of our servers, generates some XML and passes it back to IIS for display. Upon repeated use, it leaks memory... My attempts to locate the memory leak are failing, and i am flailing :) Maybe you could tell me the best way to detect memory leaks in a situation like this? Thanks -peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
Well, I'm no memory leak detection expert, so you might want to start with this: http://msdn.microsoft.com/library/en-us/vsdebug/html/vxconDetectingIsolatingMemoryLeaks.asp?frame=true[^]
-
Well, I'm no memory leak detection expert, so you might want to start with this: http://msdn.microsoft.com/library/en-us/vsdebug/html/vxconDetectingIsolatingMemoryLeaks.asp?frame=true[^]
Thanks for the reference. I've always wondered where that came from. It's something you get by default using MFC. (that's where my MFC remark came from). Anyhow -- thanks -peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
-
Thanks for the reference. I've always wondered where that came from. It's something you get by default using MFC. (that's where my MFC remark came from). Anyhow -- thanks -peter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
Some memory leak tips, start looking for misbehaving BSTRS, unreleased components and unfreed mallocs. Also you can use the perfmon and taskmanager to monitor the memory as you debug... sun.lcr
-
Some memory leak tips, start looking for misbehaving BSTRS, unreleased components and unfreed mallocs. Also you can use the perfmon and taskmanager to monitor the memory as you debug... sun.lcr
I should assert here that I undersand the basics of memory leak issues. But I need "special help" in the area of an IIS addin (ISAPI DLL). What's special about this kinda of app, is: * you write a dll * it get's loaded either directly by IIS (inetinfo.exe) * or indirectly via DLLHOST * you don't have much control of the environment All of the standard memory leak issues are covered. * balancing a delete for every new * releasing COM stuff The unknowns are: * ISAPI DLL issues * BSTR's * MSXML3 memory issues
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
-
I should assert here that I undersand the basics of memory leak issues. But I need "special help" in the area of an IIS addin (ISAPI DLL). What's special about this kinda of app, is: * you write a dll * it get's loaded either directly by IIS (inetinfo.exe) * or indirectly via DLLHOST * you don't have much control of the environment All of the standard memory leak issues are covered. * balancing a delete for every new * releasing COM stuff The unknowns are: * ISAPI DLL issues * BSTR's * MSXML3 memory issues
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
why not write you own dllhost and call/load the isap dll from there. this way you would have complete control of the loading process. as you know by now, the isapi dll is nothing more than a regular dll with a bunch of entry points of which only 2 or 3 are the most important ones. In any case, you can create a special entry point to fake the call for iis and watch the memory run... just a thought... ;) sun.lcr
-
why not write you own dllhost and call/load the isap dll from there. this way you would have complete control of the loading process. as you know by now, the isapi dll is nothing more than a regular dll with a bunch of entry points of which only 2 or 3 are the most important ones. In any case, you can create a special entry point to fake the call for iis and watch the memory run... just a thought... ;) sun.lcr
Do you know of a good reference "out there somewhere" that details this? [i have too many tasks on my plate to re-invent this]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
-
Do you know of a good reference "out there somewhere" that details this? [i have too many tasks on my plate to re-invent this]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)
not really, I had a similar experience with windows services where they run in the background and are hard to reach via the debugger. I took control of taht by creating a main function that can be compiled into an exe and the service portion is a dll. the main portion had all the serivce handles and that allows me to control what gets loaded where. I also had to spend some three month back and forth with MS but in the final analysis it was my main that really helped me. I have a book at home that details the isapi ia easy to understand format, i'll get the ref number and email it to you tomorrow... as they used to say a few months back... hope is on the way.... :) sun.lcr
-
not really, I had a similar experience with windows services where they run in the background and are hard to reach via the debugger. I took control of taht by creating a main function that can be compiled into an exe and the service portion is a dll. the main portion had all the serivce handles and that allows me to control what gets loaded where. I also had to spend some three month back and forth with MS but in the final analysis it was my main that really helped me. I have a book at home that details the isapi ia easy to understand format, i'll get the ref number and email it to you tomorrow... as they used to say a few months back... hope is on the way.... :) sun.lcr
Thanks! It is most appreciated!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [Santa Cruz Networks](http://www.santacruznetworks.com)