LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Did ListDispose work?

My question concerns the ListType variable type defined as part of the programmer's toolbox that ships with CVI.

1. Declare a ListType variable (we'll call it "myList")
2. Create the list using ListCreate
3. Add an item to the list
4. Call ListDispose (myList)

how can I check that ListDispose worked?

thanks in advance
0 Kudos
Message 1 of 4
(3,288 Views)
You could use CVIDynamicMemoryInfo() to see the before and after state of allocated memory. You can also view the code for ListDispose() under ..\CVI\toolslib\toolbox\toolbox.c if you are concerned about something not getting cleaned up correctly.

Bilal Durrani
NI
0 Kudos
Message 2 of 4
(3,272 Views)
Bilal,

Thanks for your response. I would like to be able to check the variable to determine if it has been disposed. Having looked in the source, setting the value of the ListType variable to zero after calling ListDispose can accomplish this. Because ListDispose only frees the memory occupied by the list and does not modify the value of the ListType varialbe, it is possible to generate errors by accessing a list that ListDispose has been used on. I will set the list to zero after ListDispose, assume the memory was freed successfully, and check that the list is not zero every time I access it.
0 Kudos
Message 3 of 4
(3,255 Views)
Hey guys,
  I was just needing to use this today and I finally noticed that as Zyptron points out, unlike the behavior of most other free( ) type functions, the debugger doesn't show 'Invalid: freed' when you call ListDispose( ).  Why is that?
 
Orlan
0 Kudos
Message 4 of 4
(3,179 Views)