ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Windows 10 Migration Issue
Posted by Bryan on Nov-22-2018 05:39
Hello Peter,

I currently have code where I am drawing multiple XYCharts that is working on Windows 7 without any problem. I am trying to migrate it to a Windows 10 system, and seem to be encountering a memory leak.

I have traced this down to two things-

1) I am using the trackLineAxis sample code found here:(https://www.advsofteng.com/doc/cdcppdoc/trackaxis.htm)

2) When I set the chart to the WinChartViewer using:
delete viewer->getChart();
viewer->setChart(odchart);

Commenting either of these out on their own does not resolve the leak, which is why I am unsure if the issue is in one or the other or both. I am not seeing any error messages and when I leave both these lines in and everything still appears to work properly, except for the fact that the memory usage steadily increases.

Software is built using MFC with ChartDirector 6.0 (I tried upgrading to 6.3 but the same issue persists).

Are you aware of anything that can be causing this issue or any possible workarounds?

Thank you.
Bryan

  Re: Windows 10 Migration Issue
Posted by Peter Kwan on Nov-22-2018 15:31
Hi Bryan,

I assume you are using the exact original trackLineAxis sample code, and by the "WinChartViewer", you are referring to either the CChartViewer (for MFC/C++) or QChartViewer (for Qt/C++).

In the code published in the page:

https://www.advsofteng.com/doc/cdcppdoc/trackaxis.htm

there is no "delete viewer->getChart();" line. Is the line added by yourself?

We are aware of the following behaviour of the sample code. When the chart is displayed and you move the cursor over the chart to see the "programmable track cursor", the memory will increase very slowly. All the memory will be freed once the chart object is deleted, so there is no true leak. However, in the sample code, the chart is never deleted until the window is closed. In the code published in the documentation, the chart is deleted in the destructor with the following line:

delete m_ChartViewer.getChart();

If you add "delete viewer->getChart();" to the sample code, it will have no effect, because the drawChart is only executed once, so the "delete viewer->getChart();" does not really delete anything.

If you are not using the exact original sample code, is it possible to try to modify the sample to allow it to leak memory and send the code to me? I can then try to determine where is the leak.

Regards
Peter Kwan

  Re: Windows 10 Migration Issue
Posted by Peter Kwan on Nov-22-2018 20:20
Hi Bryan,

After checking our bug database, I found that was a memory leak issue if the chart background is transparent and the project uses Windows Common Controls version 6. The bug occurs in the CChartViewer.cpp that was released between Jun 2015 to Dec 2016.

The CChartViewer.cpp and CChartViewer.h are released as part of the sample code. Those files may have been copied to your own projects. When you upgrade ChartDirector (eg. to 6.3), have you also copied the latest version of CChartViewer.cpp and CChartViewer.h to your own project?

Does you chart uses a transparent background, or does it use a rounded rectangular frame with transparent corners?

A project may be using Windows Common Control version 6 by specifying it in its manifest. So even if the code has not changed, your project may suddenly be using Windows Common Control version 6 if you compile it differently (eg. using a different project configuration). It can also be triggered by using some #pragma statements that tells the compiler to use Windows Common Control version 6. The #pragma statements can be automatically generated by Visual Studio if you let Visual Studio automatically generate some code (eg. using some kind of "wizard" that generates code).

If you compile the code in Windows 7 and verify that it does not have memory leak, and then copy the exact EXE to Windows 10 (without doing any recompilation), does it have memory leak? Even if you have not changed anything in the code, if you recompiled the code in Windows 10, it may have be recompiled differently due to different Visual Studio versions or various default configuration values.

In any case, making sure the CChartViewer.cpp and CChartViewer.h are of the latest ones (from the ChartDirector 6.3 sample code) should avoid this problem.

Regards
Peter Kwan

  Re: Windows 10 Migration Issue
Posted by Bryan on Nov-24-2018 01:29
Hi Peter,

The issue was with the transparent background. I have resolved that now and it seems to be working fine.

Thanks for the help!

Bryan