|
Heap error ChartDir51 |
Posted by Dale on May-05-2013 01:22 |
|
I upgraded from 5.0 to 5.1, and when I run my code I get a HeapAlloc error. Appears to be calling makeChart and updatePortView at the time. I increased my Heap to 100MB, but no luck. I'm only creating a chart with about 1000 OHLC candle points. The code runs fine and makes the chart in 5.0, but crashes when use 5.1. |
Re: Heap error ChartDir51 |
Posted by Peter Kwan on May-07-2013 00:20 |
|
Hi Dale,
The error is unlikely to be due to ChartDirector using too much memory. The memory usage of ChartDirector is not high, and the memory usage in 5.0 and 5.1 is similar.
Are you using C++? In C++, there can be many reasons to get various kinds of errors. To trouble-shoot, please run your code in the debugger or development environment, so as to obtain a stack trace to see if it provides any clue on the cause of the error.
Some common issues that can result in unpredictable errors are:
- Header files does not match LIB/DLL - eg. using ChartDirector 5.0 headers with ChartDirector 5.1 LIB/DLL.
- There are dangling pointers, or using chart objects that are already deleted. In particular, if your code is zoomable/scrollable, do not immediately delete your chart object after call CChartViewer::setChart to display it. (The CChartViewer may still need to chart object later as it is scrolled/zoomed.) The existing chart object should be deleted if a new chart object is created to replace the existing chart object, or if the Windows or Form closed.
Some common issues that can result in out of memory issues:
- Infinite loop, usually caused by looping events. For example, when the user drags on the chart, it triggers a "view port update" event and the chart scrolls. In addition, the event causes a "scroll bar control" also in the user interface to be updated (to reflect that the chart has scrolled). The scroll bar in turns trigger an event because it has been updated, and it cause the view port to change again, causing a loop. This type of error can easily be spotted from the stack trace.
- Using unusual parameters, such as creating a chart with a size of 1000000 x 5000 pixels.
To further trouble-shoot the problem, you may consider to comment out part of your code or modify part of your code so as to simplify them (eg. to disable all technical indicators) to see if it still produces the error. You may also consider to change to use hard coded data or even no data at all to verify it the issue is related to the data.
Regards
Peter Kwan |
|