Facing memory leak issue while using BoundsCalculator class
Sachin Tripathi
2/7/2020 5:17 AM
|
---|
Hi Wout,
We are facing memory leak issue while using BoundCalculator class to get model object boundaries. Every time when we are executing code below to calculate model boundaries it increases memory utilization by ~1GB.
var cal = new BoundsCalculator();
cal.GetBounds(pageModel, pageModel.Entities);
Note: pageModel in code, we are having ArchE size of JPEG image as a background.
Sometimes memory utilization is going beyond 5GB for single user(see attached report) and we are getting exception below:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Buffers.ConfigurableArrayPool`1.Rent(Int32 minimumLength)
at SixLabors.Memory.ArrayPoolMemoryAllocator.Allocate[T](Int32 length, AllocationOptions options)
at SixLabors.ImageSharp.Memory.MemoryAllocatorExtensions.Allocate2D[T](MemoryAllocator memoryAllocator, Int32 width, Int32 height, AllocationOptions options)
at SixLabors.ImageSharp.Image.CreateUninitialized[TPixel](Configuration configuration, Int32 width, Int32 height, ImageMetaData metadata)
at SixLabors.ImageSharp.Formats.Jpeg.JpegDecoderCore.PostProcessIntoImage[TPixel]()
at SixLabors.ImageSharp.Formats.Jpeg.JpegDecoderCore.Decode[TPixel](Stream stream)
at SixLabors.ImageSharp.Formats.Jpeg.JpegDecoder.Decode[TPixel](Configuration configuration, Stream stream)
at SixLabors.ImageSharp.Image.Decode[TPixel](Stream stream, Configuration config)
at SixLabors.ImageSharp.Image.<>c__DisplayClass55_0`1.<Load>b__0(Stream s)
at SixLabors.ImageSharp.Image.WithSeekableStream[T](Configuration config, Stream stream, Func`2 action)
at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, Stream stream, IImageFormat& format)
at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, String path)
at WW.Drawing.NetCoreBitmap.LoadBitmap(String filename, String modelFilename, Int32 downloadTimeoutMs)
at WW.Cad.Model.Objects.DxfImageDef.get_Bitmap()
at WW.Cad.Model.Entities.DxfRasterImage.get_()
at WW.Cad.Model.Entities.DxfRasterImage.get_()
at WW.Cad.Model.Entities.DxfRasterImage.(DrawContext )
at WW.Cad.Model.Entities.DxfRasterImage.DrawInternal(Wireframe context, IWireframeGraphicsFactory graphicsFactory)
at WW.Cad.Drawing.BoundsCalculator.GetBounds(DxfModel model, IEnumerable`1 entities, Matrix4D modelTransform)
at WW.Cad.Drawing.BoundsCalculator.GetBounds(DxfModel model, IEnumerable`1 entities)
So, do we have any other way to calculate model boundaries? Or any solution for this issue?
In case any sample line of code required I'll send in separate email.
Thanks,
Sachin
|
Wout
2/7/2020 3:14 PM
|
---|
Hi,
I don't see any evidence of a memory leak when I test locally. Here is my test program and test data is attached.
C# Code: Console. |