Contour map display takes a lot of memory

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Natalia Kroupnova
Newbie
Newbie
Posts: 13
Joined: Mon Jul 02, 2007 12:00 am

Contour map display takes a lot of memory

Post by Natalia Kroupnova » Thu Aug 16, 2007 5:26 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Aug 17, 2007 8:02 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Natalia Kroupnova
Newbie
Newbie
Posts: 13
Joined: Mon Jul 02, 2007 12:00 am

Contour map display takes a lot of memory

Post by Natalia Kroupnova » Fri Aug 17, 2007 5:49 pm

I uploaded SteemaTeeChart3DApp.zip which demonstrates the issue. Just click on Show chart button and see memory usage difference.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Aug 20, 2007 11:26 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Aug 22, 2007 9:48 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Aug 22, 2007 11:15 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

coler
Newbie
Newbie
Posts: 13
Joined: Wed Nov 21, 2007 12:00 am

Excessive Memory Consumption with Contours - Fixed?

Post by coler » Wed Nov 21, 2007 9:22 pm

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?

coler
Newbie
Newbie
Posts: 13
Joined: Wed Nov 21, 2007 12:00 am

Possible work around...

Post by coler » Wed Nov 21, 2007 10:03 pm

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]

coler
Newbie
Newbie
Posts: 13
Joined: Wed Nov 21, 2007 12:00 am

Sorry, no go...

Post by coler » Wed Nov 21, 2007 10:33 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Nov 22, 2007 9:48 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

coler
Newbie
Newbie
Posts: 13
Joined: Wed Nov 21, 2007 12:00 am

It does work

Post by coler » Thu Nov 22, 2007 1:49 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Nov 22, 2007 1:55 pm

Hi coler,

No problem :wink:. I'm glad to hear that works for you.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply