ThinkGeo.com    |     Blog    |     Wiki    |     Support

OutOfMemory exception drawing a line in TrackInteractiveOverlay

I am upgrading our WPF desktop application from v9 to v10.4. I noticed that our application is crashing with an OutOfMemory exception when drawing a line in the TrackInteractiveOverlay. I upgraded to the beta v11.0 and had the same issue. I then downgraded to v10.3 and I stopped getting the OutOfMemory exceptions.

I was able to reproduce the issue by creating a test application that only contains the Track and Edit Shapes sample from the How Do I application. The issue seems to be with the size of the application window. If the application window is small everything is fine. But as the application window gets larger the amount of memory used when drawing the line shoots way up and quickly crashes with an OutOfMemory exception.

Use the following steps to reproduce the issue:

  1. Start the application on a monitor with a minimum resolution of 1920x1080
  2. Maximize the application window
  3. Click the Line tool button
  4. Click in the application window to start drawing the line
  5. Move the mouse around the application window
    The faster you move the mouse the faster the memory usage increases

I have included 3 versions of the test application for the different versions of ThinkGeo I tested:

TrackAndEditShapesTest - 10.3.zip (59.7 KB)TrackAndEditShapesTest - 10.4.zip (59.9 KB)TrackAndEditShapesTest - 11.0.zip (59.9 KB)

Hi Rick,

I tested your projects and hadn’t reproduced it, it looks the memory keep stable, and it always get automatic collected.

Today my test OS is win7 X64, I don’t think it’s related with environment but I think maybe you can try to reproduce this issue in other of your PC and see whether it’s the same result, I will test it in other machine also.

Regards,

Ethan

You are seeing the same thing I am seeing. I agree that it is not a memory leak but the problem is when the memory jumps really high (e.g., 900MB) that we get an OutOfMemory exception. In previous versions of ThinkGeo (e.g., 10.3) you do not see this memory usage jumping to really high values - the memory usage stays pretty constant (e.g., around 200MB to 300MB).

Hi Rick,

Thanks for your information, we will look into it and see where is the problem.

And I found the memory usage is related with the form size.

Any update I will let you know.

Regards,

Ethan

Hi Rick,

I research it and found the change is between 10.4.2 and 10.4.3. The reason of it is our developer solve a performance issue, we set the default value of gcCollectionMode from Forced to Optimized.

So for your scenario, you can just set it back to solve the problem: wpfMap1.GCCollectionMode = GCCollectionMode.Forced;

Wish that’s helpful.

Regards,

Ethan

Thanks Ethan, that fixed the issue!

Rick

Hi Rick,

I am glad to hear that’s helpful.

Any question please let us know.

Regards,

Ethan