07-28-2005 01:36 AM
07-28-2005 03:34 AM
Sounds like you are allocating memory in some program loop, without freeing it once you have finished with it. I'm not sure that monitoring all the variables would lead you to a solution; just inspect your code carefully and ensure that each malloc() (or calloc(), or equivalent) has a matching free().
JR
07-28-2005 12:23 PM
Fabio,
Check out this post http://forums.ni.com/ni/board/message?board.id=180&message.id=17428
specificially LuisG (NI engineer) message:
"LabWindows/CVI has its own internal memory manager which is used to manage memory allocation requests that come from inside CVI (such as from UI controls). This memory manager obtains memory from the system in chunks, as needed, but doesn't always return memory to the system as soon as it becomes available (it has some fairly complicated logic for when it should return memory to the system, mainly for performance reasons).
So what you are seeing is that even though the list control has freed up its memory when you remove all those items, and the memory is now free as far as the CVI memory manager is concerned, you cannot see this "freed memory" using the Windows Task Manager. However, if you were to request another large allocation after freeing these items, you should notice that CVI will not need to allocate additional memory from the system.
Basically, a good rule of thumb, when you suspect a memory leak somewhere, is to put the action that you are suspicious of in a loop. Do it 100 or 200 times, and see if you are gradually losing memory from the system. If you are, then there is a memory leak. If not, then there is probably no leak. It's just that a lot of allocations take place on an "as needed" basis, so things don't always return to their pristine state after a single create/discard iteration.
Luis
NI"
This may explain the problems you are having. I have seen the same thing happen in my CVI programs as well.
07-29-2005 05:05 AM
Dave,
Although this could explain why CVI internally freed memory may not immediately be visible when viewed with Windows Task Manager, it doesn't actually address the problem of the apparant memory leak which was originally described, where memory usage continually increases with execution time. When you say you see the same things happen in your CVI programs, do you mean you get memory leaks or simply that memory appears not to be returned to the OS? I have some pretty big programs which run continuously and have never seen any memory leaks.
JR
07-29-2005 11:32 AM
08-01-2005 08:07 AM