SnapShot3() Memory overflow exists,how to release it?

the application memory will add about 3mb,when SnapShow3() execute once.
Now I want to create 1000 image,but it must be out of memory.

for(int i =0;i<10;i++)
{
MapWinGis.Image image = axMap1.SnapShot3(40405050.460728444,40405100.301271558,3753851.9828400007,3753815.9655599995,800);
image.Save("xxxxxxxxx");
}

I try to use “GC.Collect()”,but it still add 2mb.

Hello @apple

GC won’t have any effect because the Image is not a .NET object, but a COM object.

Try calling image.Close after each Save and see if that helps.

for(int i =0;i<10;i++)
{
    MapWinGis.Image image = axMap1.SnapShot3(40405050.460728444,40405100.301271558,3753851.9828400007,3753815.9655599995,800);
    image.Save("xxxxxxxxx");
    image.Close();
}

Regards,
Jerry.

Thank you for your reply.
I had try,but the memory still insert.
Even,I don’t define the “image”.
For example:

for(int i =0;i<10;i++)
{
axMap1.SnapShot3(40405050.460728444,40405100.301271558,3753851.9828400007,3753815.9655599995,800);
}

Although i don’t create the image object,the memory still insert.
I think: the problem is not on Image,but on the snapShot3().Maybe some value not be released in this function.

I found,if close the map,the memory will be released. T^T

@jerryfaust
I try to build 64bit appliaction,it is better than 32bit application.
The x64 can run snapShot3() in 6000 times,the x32 almost run 700 times.
But the x64 still will out of memory.

private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 8000; i++)
            {
                axMap1.SnapShot3(40405050.460728444, 40405100.301271558, 3753851.9828400007, 3753815.9655599995, 800);

            }
            
        }

Ok. I’ll try to reproduce the issue and debug the OCX.

Thank you.

@jerryfaust Is this still an issue?
If so I will create an JIRA issue for this.

Yes, Paul (@pmeems), go ahead and create an issue.
Thank you.

Yes, it is still an issue.

I created [MWGIS-259] SnapShot3() Memory overflow.