jbrwn / NET-Mapnik

.NET bindings for mapnik
34 stars 12 forks source link

SEHException (0x80004005): External component has thrown an exception #41

Open ondrasvoboda opened 6 years ago

ondrasvoboda commented 6 years ago

It seems the project is dead but anyway maybe somebody can help me. I'm using NET-Mapnik in long running process which creates PNG tiles for big maps. But sometimes when the map is too big and process is running for a long time (>10 hrs) I get crash with this exception.

System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
in mapnik.image_any.{ctor}(image_any* , Int32 , Int32 , image_dtype , Boolean , Boolean , Boolean )
in std._Ref_count_obj<mapnik::image_any>.{ctor}<int &,int &>(_Ref_count_obj<mapnik::image_any>* , Int32* <_Args_0>, Int32* <_Args_1>)
in std.make_shared<struct mapnik::image_any,int &,int &>(shared_ptr<mapnik::image_any>* , Int32* <_Args_0>, Int32* <_Args_1>)
in NETMapnik.Image..ctor(Int32 width, Int32 height)

I think it has something to do with memory which is continuously growing all the time (maybe a memory leak in Image class?). But I dont know where to get more info about the exception in external component.

Below is simplified code I'm using to generate maps. (it runs in a loop for all map parts and zooms)

using (NETMapnik.Map map = new NETMapnik.Map(4096, 4096))
{
    map.FromString(style, true, path);
        map.ZoomToBox(minx, miny, maxx, maxy);

        using (Image img = new Image(4096, 4096))
    {
        map.Render(img, renderOptions);

                // cut image to 256x256 PNG files and save
    }
}

Any help will be very welcome Thanks Ondra