01-28-2014 03:31 PM
My application runs fine in Debug mode. I have several threads. A couple just blink some LEDS. In release mode they don't blink and my main function that is triggered by a button which runs a callback function that launches another thread doesn't work.
01-28-2014 03:41 PM - edited 01-28-2014 03:46 PM
Just checked resources when it runs in Release mode and 'free' memory is going to zero then it crashes. I have some large arrays but the computer has 4G so not sure what 'free' is versue Available. There's 1.5G available. I've never had a Labwindows application that wouldn't run in release mode so this is new territory for me.
01-28-2014 06:05 PM
It has something to do with thread callbacks in my program. I'm using this function
CmtScheduleThreadPoolFunction (DEFAULT_THREAD_POOL_HANDLE, acquiretime, NULL, &functionId5);
I have some simple things like flashing LEDS and a numeric that displays seconds. In debug all is well. In release program fails. The LEDS flash a few times then stop then shortly the GUI closes down.
01-29-2014 01:55 AM
Hello,
it's difficult to try guessing what's happening with no informations available. Apparently ther's something that's causing a program crash in release mode and you suppose it relates to some problem in memory allocation. Additionally, it seems your program is consuming system resources until it fills up all available memory.
Are you freeing the dynamic memory when no longer needed? Are you sure you don't have any memory leak that can cause this increment in memory occupation? You must double check that every dynamic array allocated is freed when no longer used; you may want to swap part of the dynamic memory to disk if you are not using it constantly.
Additionally, have you a consistent and robust error checking method that logs all errors found to the user interface or to disk?
Another hint if you have CVI2009+ can be to activate extended debugging level in Build Options, next run the program some time in debug mode and close it: if some resources are not properly freed the Resource tracking window should appear with all allocated resources listed that are not correctly freed by the code.
01-29-2014 10:58 AM
I ran the program in release mode and got a stack overflow error. I have a very large array that was causing the problem. I defined it as static and now it runs in release. It doesn't appear thread related just the large array.