Page 1 of 1

Contour map display takes a lot of memory

Posted: Thu Aug 16, 2007 5:26 pm
by 13045844
When displaying contour map (5500 points) - TeeChart takes ~50mb of memory to display it. This is around ~10K per point - seems too much! We need to display 4 maps simluatanesouly and this requires 200MB!

May be there are some option sot reduce the memory consumption?


Let me know if you need an example - I can upload.

Posted: Fri Aug 17, 2007 8:02 am
by narcis
Hi Natalia,

Yes please, send us a simple example project we can run "as-is" to reproduce the problem here.

You can upload your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Please let us know here when you have posted your files.

Thanks in advance.

Contour map display takes a lot of memory

Posted: Fri Aug 17, 2007 5:49 pm
by 13045844
I uploaded SteemaTeeChart3DApp.zip which demonstrates the issue. Just click on Show chart button and see memory usage difference.

Posted: Mon Aug 20, 2007 11:26 am
by narcis
Hi Natalia,

Thanks for the example project. Yes, there is a problem with contour series and we will investigate this issue. We will get back to you when we have further news.

Posted: Wed Aug 22, 2007 9:48 am
by narcis
Hi Natalia,

After reviewing your project we found that you were calling TeeChart's Refresh method in a redundant way as it is called before the EndUpdate method which it calls Refresh again. Commenting out the first call as shown in the code below enhanced significantly the project's memory consumption.

Code: Select all

			teeChart.Series.Add(surface);
			teeChart.Series.Add(contour);
			//teeChart.Refresh();
			EndUpdate();
Could you please try making this modification in your project and press the Show Chart button several time so that you can see how the memory consumption is not always increasing?

Thanks in advance.

Posted: Wed Aug 22, 2007 11:15 am
by narcis
Hi Natalia,

My suggestion above reduces the memory consumption but it's still obvious that contour series consumes much more memory than surface series. We think this is a bug (TF02012412) to be fixed for future releases.

Excessive Memory Consumption with Contours - Fixed?

Posted: Wed Nov 21, 2007 9:22 pm
by 10047436
Narcis (or anyone else), has this memory consumption bug during Contour drawing been fixed?

I'm experiencing an extreme memory usage situation running Pro v.8.02 on Borland CBuilder 5. Reproducing the problem is extremely simple: Simply create a TChart having a TContourSeries. Then click on the "Data Source" tab and change the "Number of sample values" to 5000. I've currently only tested this on my laptop which only has 512 megs of ram, but it reliably and consistently crashes Borland CBuilder in short order (after you click the Apply button). A quick look at the task manager during this operation shows that RAM is quickly exhausted. The only solution is to use the Task Manager to forcibly kill the bcb.exe process.

The same problem occurs after compiling the software and while attempting to draw contours having a large number of data points, regardless of the grid size. You can reproduce this problem at design time or during runtime.

Any ideas or time-frame on a fix for this?

Possible work around...

Posted: Wed Nov 21, 2007 10:03 pm
by 10047436
Hmmm... I've been fiddling with this now for more than a day and finally discovered something quite by accident...

I'm not absolutely certain this fixes all instances, but it seems to be working for me in runtime using a bunch of different grid sizes and data sizes (the design flaw is still there).

If you have a lot of data points (I have over 30,000 data points I need to contour), I have discovered that if you insert the following statements into the loop that reads data and sends the data to the contouring routine, the problem of excessive memory usage seems to be resolved:

Code sample:

for(x=0;x<maxx;x++) {
// Insert the following three lines into the loop
ContourSeries->NumXValues=XX;
ContourSeries->NumZValues=ZZ;
ContourSeries->IrregularGrid=true;
for(z=0;z<maxz;z++) {
ContourSeries->AddXYZ(x,randomnum,z);
}
}

Inserting the NumXValues... statements into the loop seems to completely resolve the excessive memory problem. I was able to contour 30,000 data points without any difficulties, whereas without these statements, the contouring function sucked up all available system memory (and virtual memory) and basically killed the machine.

I have no idea why this works, but it seems to solve the problems (so far in my testing, anyway).[/quote]

Sorry, no go...

Posted: Wed Nov 21, 2007 10:33 pm
by 10047436
Unfortunately, it looks like I spoke too soon. If I feed the contouring system a different type of data, it fails even with these statements. Hmmm.... I thought I had a work around. Sorry. I guess not.

It appears the data that is fed to the contouring routines needs to be fairly well ordered and smoothed - perhaps better ordered than what I have.

Posted: Thu Nov 22, 2007 9:48 am
by narcis
Hi coler,

First of all, please notice that this is the TeeChart for .NET forum and therefore reported issue is for TeeChart for .NET. However you are using TeeChart VCL, so we'd appreciate you to post your inquiries at the corresponding forum.

Regarding the issue you reported, It works fine for me here using this code:

Code: Select all

	for(int x=0;x<300;x++)
	{
		for(int z=0;z<100;z++)
		{
			Series1->AddXYZ(x,x+z,z);
		}
	}
The code snippet above draws a contour series with 30000 points. Notice that I'm not using IrregularGrid=true unless it is strictly necessary as it slows down series plotting. Is the code above working fine at your end?

For more information on how such series styles work please read this thread.

BTW: The TeeChart for .NET issue originally reported here hasn't been fixed yet.

It does work

Posted: Thu Nov 22, 2007 1:49 pm
by 10047436
Silly me. Sorry for posting in the wrong forum. I thought I was in the VCL forum.

The code you posted does work for me.

Posted: Thu Nov 22, 2007 1:55 pm
by narcis
Hi coler,

No problem :wink:. I'm glad to hear that works for you.