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

Message ListMessage List     Post MessagePost Message

  Memory Bleeding trackfinance
Posted by Dave on Jun-17-2020 03:22
Attachments:
I'm afraid  I created a memory bleed in my application by adding a redraw member method almost identical to your original drawChart. I attach the .cpp and .h files.

Every time there is new data method redraw is called to present the chart. And that accumulates memory use that is not freed until the crash of the program

I've tried to define some array pointers as private members of the class shared everytime the method is called, and to define as intelli9gent pointers so they get distroyed automatically, and the program throws a memory fault on the call to setdata.

I'm afraid I don't understand the C style pointers and get very scared by them.

Many thanks for your help!
trackfinance.cpp
trackfinance.cpp

26.93 Kb
trackfinance.h
trackfinance.h

1.71 Kb

  Re: Memory Bleeding trackfinance
Posted by Peter Kwan on Jun-17-2020 14:08
Hi Dave,

In both drawChart and redraw,  try to change the line:

    m_ChartViewer->setChart(c);

to:

    delete[] buySignal;
    delete[] sellSignal;
    delete[] exitSignal;
    delete m_ChartViewer->getChart();
    m_ChartViewer->setChart(c);

Regards
Peter Kwan

  Re: Memory Bleeding trackfinance
Posted by Dave on Jun-17-2020 18:46
Thanks Peter!