Browse Source

Memory Optimization: releasing native resources as soon as possible in the Dynamic Component

Marcin Ziąbek 9 months ago
parent
commit
e4942603f7
1 changed files with 1 additions and 0 deletions
  1. 1 0
      Source/QuestPDF/Elements/Dynamic.cs

+ 1 - 0
Source/QuestPDF/Elements/Dynamic.cs

@@ -33,6 +33,7 @@ namespace QuestPDF.Elements
             var result = ComposeContent(availableSpace, acceptNewState: false);
             var result = ComposeContent(availableSpace, acceptNewState: false);
             var content = result.Content as Element ?? Empty.Instance;
             var content = result.Content as Element ?? Empty.Instance;
             var measurement = content.Measure(availableSpace);
             var measurement = content.Measure(availableSpace);
+            content.ReleaseDisposableChildren();
             
             
             if (measurement.Type is SpacePlanType.PartialRender or SpacePlanType.Wrap)
             if (measurement.Type is SpacePlanType.PartialRender or SpacePlanType.Wrap)
                 throw new DocumentLayoutException("Dynamic component generated content that does not fit on a single page.");
                 throw new DocumentLayoutException("Dynamic component generated content that does not fit on a single page.");