mono / libgdiplus

C-based implementation of the GDI+ API
http://www.mono-project.com/
MIT License
329 stars 171 forks source link

Out of memory #717

Closed duojieyangaspose closed 2 years ago

duojieyangaspose commented 2 years ago

When I execute the following code snippet in a Linux environment, an out of memory error occurs.

System.Collections.Stack GraphicsStateStack = new System.Collections.Stack();
Bitmap bmp = new Bitmap(500,600);
Graphics gm = Graphics.FromImage(bmp);
for(int i=0; i<1000; ++i)
{
    GraphicsStateStack.Push(gm.Save());
    GraphicsState st = (GraphicsState)GraphicsStateStack.Pop();
    gm.Restore(st);
    st = null;
}

I consulted Microsoft and they told me I need to ask you. The post: System.Drawing.Common 'Out of memory.' Can you provide a solution or fix? thank you very much!

peterzhou-aspose commented 2 years ago

I met the same issue,is there any fix

duojieyangaspose commented 2 years ago

This problem seems to be resolved in 6.0.5. The library I compiled with the latest code does not have this problem.