08-01-2012 12:19 AM
hello guys,
I want to know CA_FreeMemory(); really free the memory.
For eg:
char* seqName=0;
TS_SequenceGetName (Sequence_Obj, &errorInfo, &seqName);
if (seqName) CA_FreeMemory (seqName);
I see that seqName still has some address after executing CA_FreeMemory (seqName);
Any clarifications appreciated.
Jis
08-07-2012 06:59 AM
Even I am facing the same problem with "CA_Freememory". In the below code the memory allocated to the pointer "sequencename" from the function call " TS_SequenceGetName" doesn't get freed even after calling the "CA_Freememory". Please can anyone suggest the work around for this error.
#include <cviauto.h>
#include "tsapicvi.h"
#include <utility.h>
#include"test.h"
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
if (InitCVIRTE (hinstDLL, 0, 0) == 0)
return 0; /* out of memory */
break;
case DLL_PROCESS_DETACH:
CloseCVIRTE ();
break;
}
return 1;
}
int __stdcall DllEntryPoint (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
/* Included for compatibility with Borland */
return DllMain (hinstDLL, fdwReason, lpvReserved);
}
int __declspec (dllexport) __stdcall getcontext(CAObjHandle thiscontext)
{
TSObj_Sequence newobjt=0;
char *sequencename=NULL;
ERRORINFO errorInfo;
TS_SeqContextGetSequence(thiscontext,&errorInfo,&newobjt);
TS_SequenceGetName(newobjt,&errorInfo,&sequencename);
CA_FreeMemory(sequencename);
return 0;
}