Browse Source

Improved memory management for Shared Image API by adjusting GC Memory Pressure

Marcin Ziąbek 10 months ago
parent
commit
15907b8b7d
2 changed files with 8 additions and 1 deletions
  1. 5 1
      Source/QuestPDF/Resources/ReleaseNotes.txt
  2. 3 0
      Source/QuestPDF/Skia/SkImage.cs

+ 5 - 1
Source/QuestPDF/Resources/ReleaseNotes.txt

@@ -12,4 +12,8 @@ Version 2025.1.1
 Version 2025.1.2
 - Adjusted the behavior of Row.AutoItem to preserve its size when a Row element spans multiple pages.
 - Improved Linux compatibility by including the necessary native dependencies (OpenSSL and libjpeg-turbo).
- 
+ 
+
+Version 2025.1.3
+- Fixed a rare layout rendering bug in the Table element.
+- Improved memory management for Shared Image API by adjusting GC Memory Pressure.

+ 3 - 0
Source/QuestPDF/Skia/SkImage.cs

@@ -22,6 +22,8 @@ internal sealed class SkImage : IDisposable
         Width = details.Width;
         Height = details.Height;
         EncodedDataSize = details.EncodedDataSize;
+        
+        GC.AddMemoryPressure(EncodedDataSize);
     }
 
     public static SkImage FromData(SkData data)
@@ -70,6 +72,7 @@ internal sealed class SkImage : IDisposable
         API.image_unref(Instance);
         Instance = IntPtr.Zero;
         GC.SuppressFinalize(this);
+        GC.RemoveMemoryPressure(EncodedDataSize);
     }
     
     private static class API