02-25-2009 12:08 PM
Hi everybody,
I'm currently developing an application using LabWindows/CVI 8.1 on an WinXPSP3 machine. To allow easy automation of the functions in my application, I decided to add an ActiveX Server interface to my application and first tests look very promising. However, after I have introduced a string-type property to my ActiveX server I get a strange error when the get method is called by the client. The automatically generated code of the ActiveX server receives the string from the application and converts it into a BSTR that is returned to the client. The string pointer returned by the application function is converted into this BSTR and later on in the automatically genereated function the string pointer is freed with a call to CA_FreeMemory (). In general this should works fine but when I run my application in Debug mode the execution is halted at this point (even when there is no break point) and the debug window shows the following message:
HEAP[application_debug.exe]: Invalid Address specified to RtlFreeHeap( 00140000, 027995E0 )
Actually the allocated memory is not freed.
I have generated a small example project that reproduces the issue. The error happens in autotest_axs.c in line 71, a breakpoint is set for convenience. The additionally attached LabVIEW VI is used to operate as the ActiveX client and performs the necessary calls to reproduce the effect. Just build the CVI project in debug mode and start the VI while the CVI application is running.
For now I don't think I'm doing something wrong, maybe anybody at NI has an idea.
Thanks in advance!
Torsten
Solved! Go to Solution.
02-26-2009 09:45 AM
03-02-2009 02:29 AM
Thanks for the quick and helpful reply. Using CA_AllocMemory () indeed fixes the problem.
The only "bad taste" remaining here is the lack of documentation. I haven't found a note that there are two indepnedent memory managers.
But anyway, now it works. Thanks again!
Torsten