FileOnQ / Imaging.Heif

A C#/.NET wrapper around libheif for decoding and processing high efficiency image formats (heif, heic).
GNU Lesser General Public License v3.0
15 stars 4 forks source link

.NET 6 Memory Leaks #67

Closed SkyeHoefling closed 2 years ago

SkyeHoefling commented 2 years ago

Description

There is a very small memory leak with .NET 6 when writing an image to storage. See benchmarking results below

BenchmarkDotNet=v0.13.0, OS=Windows 10.0.19043.1415 (21H1/May2021Update)
AMD Ryzen 9 3950X, 1 CPU, 32 logical and 16 physical cores
.NET SDK=6.0.100
  [Host]     : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
  Job-KBXXVN : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT

Runtime=.NET 6.0  InvocationCount=1  LaunchCount=1
UnrollFactor=1

|             Method |     Mean |    Error |   StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated | Allocated native memory | Native memory leak |
|------------------- |---------:|---------:|---------:|------:|------:|------:|----------:|------------------------:|-------------------:|
|    Thumbnail_Write | 65.39 ms | 0.928 ms | 0.868 ms |     - |     - |     - |     832 B |             5,982,865 B |               32 B |
|  Thumbnail_ToArray | 63.64 ms | 0.366 ms | 0.324 ms |     - |     - |     - |  66,888 B |             5,982,157 B |                  - |
|   Thumbnail_ToSpan | 63.72 ms | 0.403 ms | 0.377 ms |     - |     - |     - |     600 B |             5,981,901 B |                  - |
| Thumbnail_ToStream | 63.90 ms | 0.388 ms | 0.363 ms |     - |     - |     - |  66,952 B |             5,981,901 B |                  - |