LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory leakage in Table control

Hello
 
In a table control on my event i need to add certain required number of rows. Since table size was growing very fast hence memory occupancy was growing i decided to delete initial rows.  Now on every event i add certain number of rows and delete some rows. In this process also i am finding huge memory leakage. I am attaching the source code for early feedback
 
Thanks and Regards
Rakesh
 
 
0 Kudos
Message 1 of 8
(4,116 Views)

Hello Rakesh,

Can you reattach the code that demonstrates the behavior?  It seems to have gotten lost.

Thanks.

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 8
(4,093 Views)
Hello Wendy
 
Please find the code....Hoping for a quick solution...
 
Thanks and Regards
Rakesh
0 Kudos
Message 3 of 8
(4,088 Views)

I had to reorganize your code a bit since I don't have your database or datasocket sources. However, I think my modified version hits all your code paths. The only leaked memory I found was being leaked in DSCallbackAlarms; at the bottom when you free up all the memory, you fail to free ChValue.

Note that you can use CVIDynamicMemoryInfo() to track the number of allocated blocks and their sizes to help find problems like these.

If you think you are seeing other leakage, please post more details indicating what you are observing.

Regards,

-alex

0 Kudos
Message 4 of 8
(4,075 Views)
Hello Alex
 
Thanks ! I will check and let you know.
 
Regards
Rakesh
0 Kudos
Message 5 of 8
(4,058 Views)
Hello Alex
 
I made the necessary modification to free the ChValue and also using CVIDynamicMemoryInfo() to check the information about dynamic memory allocation. I observed the fixed number of blocks and allocated byes for every cycle but in "Task Manager" i observed memory usage is gorwing continuously i left my application running for around 15 hrs i observed memory usage showed as large as 90MB (huge memory leakage) . I feel there is no memory leakage in due to dynamic allocation but due to inserting new rows in table. If i comment the block where i am doing table operation in  DSCallbackAlarms function Memory Usage in Task Manager show almost fixed memory usage. I am attaching the modified version of the code. Please advice further.
Hoping for your kind help.
 
Thanks and Regards
Rakesh
0 Kudos
Message 6 of 8
(4,041 Views)
Rakesh,
 
Attached is the modified version of AlarmDisplay.c I used to try and find table memory leaks (since I don't have your datasocket sources). It basically calls all the table update code in a tight loop. I ran this for an extended period of time and didn't see any memory leaks. I also visually inspected all the code that I couldn't run directly (the other datasocket callbacks, etc.) and everything looked OK there.
 
Based on this, I don't think the table is directly responsible (at least I can't reproduce any leaks with it). Could you try running my modified version and see if you are seeing a leak? Also, what version of the runtime engine are you using to reproduce this (and what version of CVI are you using to build the application)? What OS? What kind of usage pattern does the application see? Is there a user consistently interacting with it? Try and give me as much detail as you can.
 
If you can provide me with a version that I can run unmodified (particularly with respect to datasocket sources and the database) I can take a look at that. We also can't rule out the possibility that the memory usage you are seeing is allocated from the system by the CVI memory manager but is "free" for CVI to use and not being leaked (the conditions under which CVI releases memory back to the system can be complex).
 
Best of luck,
 
Alex
0 Kudos
Message 7 of 8
(4,019 Views)

Hello Alex

Thanks a lot....I used your modified version and i am not finding any memory leaks but now i will investigate more my application to check for memory leak. and let you know. There is another acitivity which is making my application slower i.e. updation of rows. As you must have observed some columns like" End Alarm Date and Time", "Value" and "Status" these columns will be filled once and channel comes out from previous Alarm State. And i have separate callback DSCallbackEndAlarms which provide me necessary information. This values may not be in order unlike when i add new rows in order for new alarms.  So i have to do cell by cell using SetTableCellVal. This makes my application very slow. Please advice...

If  memory leak problem continue i will make application which you will be able to run without any modification but i may  take some time to do so..

Hoping for your kind cooperation as before

Regards and Many Thanks

Rakesh

 

0 Kudos
Message 8 of 8
(4,011 Views)