Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 938 - Memory leak at RemoveSeries
Summary: Memory leak at RemoveSeries
Status: RESOLVED NOTABUG
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Series (show other bugs)
Version: 140923
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Steema Issue Manager
URL: http://www.teechart.net/support/viewt...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-01 10:47 EDT by yeray alonso
Modified: 2014-10-09 12:17 EDT (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yeray alonso 2014-10-01 10:47:04 EDT
RemoveSeries does not release the memory allocated to the removed series. 
If you open up TaskManager you'll see the memory allocated increases and never decreases:

uses Chart, Series;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;
  Chart1.Align:=alClient;

  with TTimer.Create(Self) do
  begin
    Interval:=100;
    OnTimer:=Timer1Timer;
    Enabled:=true;
  end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  while Chart1.SeriesCount > 0 do
    Chart1.RemoveSeries(0);

  Chart1.AddSeries(TBarSeries).FillSampleValues();
end;
Comment 1 david berneda 2014-10-09 12:17:34 EDT
RemoveSeries simply removes the series from the chart.
It is equivalent to:

Chart1[0].ParentChart := nil;

or:

Series1.ParentChart := nil;

To destroy the series, do:

Series1.Free;

or:

Chart1[0].Free;

or, for all series in a chart:

Chart1.FreeAllSeries;