Board index » cppbuilder » Is there a memory leak/problem in this code?
Is there a memory leak/problem in this code?
2004-08-05 08:47:47 PM
I have the below method in an ASP ActiveX object. The ASP page instanciates the object (and makes method calls) for a while, then all of a sudden I get one of those famous "error '80010105'" errors when this method is called from the ASP page. Is there something up with the BSTRs? I know BSTR memory mgt can be tricky if you're unfamiliar with how they work (which I think I am, a little).
All other methods execute with no problem. I've tried using try-catch to print out more info, but it didn't change anything -- like it was untrappable.
Also, is it a problem that the methods aspwrite_this(), aspwrite_that(), and aspwrite_something_else() are all public (STDMETHODIMP) methods exposed by the ASP object?
Anyway, if anyone's got a clue on this, I'd much appreciate the feed back. Thanks! Here is the method:
STDMETHODIMP TmyappImpl::out_to_browser(BSTR width, BSTR action, long id)
AnsiString myaction = AnsiString(action);
if( myaction == "showthis" )
aspwrite_this( width, start, max );
else if( myaction == "showthat" )
aspwrite_that( id );
else if( myaction == "showsomethingelse" )
aspwrite_something_else( id );
aspwrite_this( width );
return( S_OK );