NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

free memory

CA_FreeMemory(string_variable);

This is how we suppose to free memory in LabWindows when we get a string from TS.

My question is: can I use the same veriable to get different length strings or do I need a different veriable for each string I get from TS?

Thanks
Rafi
0 Kudos
Message 1 of 3
(3,329 Views)
Rafi -
Code in LabWindows/CVI might look like the code below. The stringVal variable is allocated memory. Before calling any subsequent call that returns allocated memory, the string must be freed.

char *stringVal = NULL;

TS_PropertyGetValString(propObj, &errorInfo, "Step.Limits.String", 0, &stringVal);
CA_FreeMemory(stringVal);

TS_PropertyGetValString(propObj, &errorInfo, "Step.Result.Status", 0, &stringVal);
CA_FreeMemory(stringVal);

Scott Richardson (NI)
Scott Richardson
https://testeract.com
Message 2 of 3
(3,329 Views)
Thank you Scott,

I guess my question was aroused since I've always followed the TS template where the CA_FreeMemory(stringVal) is done at the end...

I'll start using it the way you indicated.

Thanks
Rafi
0 Kudos
Message 3 of 3
(3,329 Views)