1
votes

I'm using Lumia Imaging SDK v2 to compress and crop images in my application. Recently we came across an issue related to compression and cropping of .wdp format images; JpegRenderer.RenderAsync() repeatedly crashes with that particular format type.

To fix this issue, we upgraded to SDK v3, but on memory profiling of the application, I found that memory usage in SDK v3 is considerably higher than SDK v2 (see attached screenshots).

SDK v2 memory profiling: SDK v2 memory profiling

SDK v3 memory profiling: SDK v3 memory profiling

The peaks in v2 max out at 55 MB but in v3 the peaks reach > 160 MB. In v2 I used StorageFileImageSource to load images into memory. In v3 I use BifferImageSource to do the same. I'm also using using statements to dispose off datatypes implementing the IDisposable.

Any reason why this memory bloat is observered in v3? Any way I can avoid it? Also, is there any way to render .wdp format images in v2 itself?

1

1 Answers

3
votes

Lumia Imaging SDK 3.0 uses more memory than 2.x when processing on GPU (only CPU processing existed on 2.x). The difference here comes from the fact that CPU will process the entire image at the same time, so not use tiling - at least not in RAJPEG sense, so you will need entire image resources in memory at the same time.

To achieve 2.x level of memory performance you can set CPU only rendering on your render. Please note that this will also disable the performance boost that GPU brings.

Take a look at [Renderer].RenderOptions property. Set it to RenderOptions.OnlyCPU in this case.

I strongly suggest reading all the docs about changing RenderOptions as it comes with some non-obvious side affects.