Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

"Out of memory message" on cwgraph

I created an application (VC++) with six cwgraphs runnning simultaniously. A single plot is displaed on each graph every second (updated with plotXvsY).
After afew hours I get the "out of memory" message.
Checking the task menagger shows my app is gaining memory usage without proportion to the data generated.
Another thing, when I minmize my app and maximize it again, memory usage drops dramatically and then starts growing up - starting from the new (small) usage value.
I tried running my app without display the data on the graph (it was generated though) and the memory usage didn't grow so dramatically.
I realize that the graph module saves a copy of the data, but it still shouldn't cause this problem and of course min/maxing the
software shouldn't drop the memory usage like it does.

Any ideas?
0 Kudos
Message 1 of 7
(3,719 Views)
Chad,

Could you send an e-mail to ni.com/ask with your VC++ program attached so that we can try to reproduce this here at NI Technical Support? We haven't seen this before, so we'd like to take a look at it.

Thank you,
Azucena
NI
0 Kudos
Message 2 of 7
(3,718 Views)
Regarding the memory usage dropping when you minimize your application, this is probably due to the operating system trimming the working set of the process. The working set is the set of memory pages that are currently visible to the process in memory, so access to this memory is very fast because the pages are available to the application without triggering a page fault. The OS often swaps these pages out when an application is minimized.

Regarding the out of memory message when plotting data on the graph, is it correct that each graph is only showing one point at a time, or is each graph adding another point to the history of points every second? If the latter, what is the value of the graph's ChartLength property? Are there any other graph feature
s that you're using, such as annotations or cursors? Can you reproduce this in a small separate test project, and if so, could you please post this project so we can see what else might be causing this? Thanks.

- Elton
0 Kudos
Message 3 of 7
(3,718 Views)
1. Each graph is showing an array of points (up to 80000)starting from none and adding one per second.

2. The CharLength is 0. does it make a diffrence when using PlotXvsY ? AutoScale is disabled, I'm rescaling myself each time, to fit all the available data.
3. Some of the graphs use points insted of lines.
4. text annonations are displayed on two of the graphs.
5. I am not using wraper clases, I have the CW6.0 components only. I use colesafearrays to trasfer data.
I tried to run the complete code (arrays were created)
but removed the plotxvsy commands and memory was ok(no graph displayed obvoiously).

7. I tried adding ClearData() before plotting - no change.

I will try to create a project,
Can you comment on this info?
0 Kudos
Message 4 of 7
(3,718 Views)
Another small question, is there a diffrent way fro creating the variant arrays used by PlotXvsY ?
I'm using :
XDataArray.CreateOneDim(VT_R8, m_OffLineData->XArray.GetSize(), m_OffLineData->DataArray[DataEntryIndex].XArray.GetData()) ;

I don't have the NI wrappers

Thank you
0 Kudos
Message 5 of 7
(3,718 Views)
1.) If you're using PlotXvsY and you're adding one point per second, how are seeing an array of points in the graph? Are you replotting all previous values every time you plot new values? If not, how is this handled? If so, why not use ChartXvsY?

4.) This might have something to do with the problem. There is a known issue with memory leaks when using annotations and there is a hotfix available for this issue at ftp://ftp.ni.com/support/compworks/ windows/Hotfixes/Annotations/.

5.) Is there a reason for using the MFC-generated wrappers instead of using the Measurement Studio for Visual C++ interfaces?

- Elton
0 Kudos
Message 6 of 7
(3,718 Views)
Just a quick correction to the ftp address posted above. It should be

ftp://ftp.ni.com/support/mstudio/vc/fixes/6.0/Annotations/
0 Kudos
Message 7 of 7
(3,718 Views)