Jelajahi Sumber

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

Marcin Ziąbek 10 bulan lalu
induk
melakukan
15907b8b7d

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

@@ -12,4 +12,8 @@ Version 2025.1.1
 Version 2025.1.2
 Version 2025.1.2
 - Adjusted the behavior of Row.AutoItem to preserve its size when a Row element spans multiple pages.
 - 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).
 - 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;
         Width = details.Width;
         Height = details.Height;
         Height = details.Height;
         EncodedDataSize = details.EncodedDataSize;
         EncodedDataSize = details.EncodedDataSize;
+        
+        GC.AddMemoryPressure(EncodedDataSize);
     }
     }
 
 
     public static SkImage FromData(SkData data)
     public static SkImage FromData(SkData data)
@@ -70,6 +72,7 @@ internal sealed class SkImage : IDisposable
         API.image_unref(Instance);
         API.image_unref(Instance);
         Instance = IntPtr.Zero;
         Instance = IntPtr.Zero;
         GC.SuppressFinalize(this);
         GC.SuppressFinalize(this);
+        GC.RemoveMemoryPressure(EncodedDataSize);
     }
     }
     
     
     private static class API
     private static class API