LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

fatal run-time error with PlotStripChartPoint

Hi Folks,
my application generate a fatal run-time error after running for a while:
 FATAL RUN-TIME ERROR:   "..\log.c", line 302, col 5, thread id 0x00000418, function id 1:   The program has caused a 'General Protection' fault at 001B:68640394.

The code is the following:

PlotStripChartPoint(DUT_Current, DUTCURRENT_CHART, Current);

DUT_Current is a global variable located in an other C file, Current is a local double variable.
The chart is in a TAB (I use easytab).
I use also 2 charts in an other tab, they crash in the same way.

I tried to run the application on an other computer but the behavior is the same.

Could you help me please ?
0 Kudos
Message 1 of 5
(3,330 Views)

Assuming that the crash occurs within the CVI IDE debug environment, does the value of DUT_Current still have a sensible value afterwards? It is possible that this handle is getting corrupted somewhere else in your program. Or if the handle is still a reasonable value maybe the panel to which it refers is being closed unexpectedly?

JR

0 Kudos
Message 2 of 5
(3,328 Views)
the crash occurs in debug and release mode. I'm going to place a watch on the DUT_Current variable.
The same crash also appears for 2 different charts located in an other tab.

I also tried to do the following in my function to avoid the use of a global variable for the panel, but it does not work (nothing is plotted on the graph):
CurrentPanel = LoadPanel(0, "DUT_Current.uir", DUTCURRENT);
PlotStripChartPoint(CurrentPanel , DUTCURRENT_CHART, Current);
0 Kudos
Message 3 of 5
(3,326 Views)
IIRC, when using the EasyTab controls you need to obtain a panel handle from the EasyTabLoadPanels() function call, instead of from the usual LoadPanel() one, so this probably accounts for why your alternative did not work.
 
In debug mode, you can interrogate the variable immediately after the crash, without needing to put a watch on it. It does not sound as though it is becoming corrupted, though - you have just experienced what happens if you call PlotStripChartPoint() with an incorrect handle - nothing happens (neither plots points nor crashes...) so maybe we need to look elsewhere. Can you see if there is a memory leak in the program, by using Windows Task Manager, for example? Could account for the fact that it works for some time before crashing.
 
JR
0 Kudos
Message 4 of 5
(3,322 Views)
Thank's JR for your help. I think you are right by evoking a probably memory leak problem.

I decided to modify my tabs created with canvas and easytab control (The application was originally designed with CVI 7) with the tab control available in CVI 8.1 and the crash occurs laters in the time now. Now, I use local variables to store the handle of the tab containing the graphs (variable is set with GetPanelHandleFromTabPage).
The amount of memory always increase in the Windows task manager.but more slowly than the previous version of my code (global variable).


0 Kudos
Message 5 of 5
(3,315 Views)