[UWP][Memory] [Rendered Cards Leaking Memory]
See original GitHub issuePlatform
- UWP
Version of SDK
AdaptiveCards.Redering.Uwp V1.2.2
Details
When redering an adaptive card, it appears that its memory is not released. The bellow code sample loads an adaptive card, displays it on the UI before removing it and forcing a garbage collection. After 50 itteraltions, an additional 90MB of memory is being used by the test app.
var renderer = new AdaptiveCardRenderer();
string card = "{ \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\", \"type\": \"AdaptiveCard\", \"version\": \"1.0\", \"body\": [ { \"type\": \"TextBlock\", \"text\": \"Publish Adaptive Card schema\", \"weight\": \"bolder\", \"size\": \"medium\" }, { \"type\": \"ColumnSet\", \"columns\": [ { \"type\": \"Column\", \"width\": \"auto\", \"items\": [ { \"type\": \"Image\", \"url\": \"https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg\", \"size\": \"small\", \"style\": \"person\" } ] }, { \"type\": \"Column\", \"width\": \"stretch\", \"items\": [ { \"type\": \"TextBlock\", \"text\": \"Matt Hidinger\", \"weight\": \"bolder\", \"wrap\": true }, { \"type\": \"TextBlock\", \"spacing\": \"none\", \"text\": \"Created {{DATE(2017-02-14T06:08:39Z, SHORT)}}\", \"isSubtle\": true, \"wrap\": true } ] } ] }, { \"type\": \"TextBlock\", \"text\": \"Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.\", \"wrap\": true }, { \"type\": \"FactSet\", \"facts\": [ { \"title\": \"Board:\", \"value\": \"Adaptive Card\" }, { \"title\": \"List:\", \"value\": \"Backlog\" }, { \"title\": \"Assigned to:\", \"value\": \"Matt Hidinger\" }, { \"title\": \"Due date:\", \"value\": \"Not set\" } ] } ], \"actions\": [ { \"type\": \"Action.ShowCard\", \"title\": \"Set due date\", \"card\": { \"type\": \"AdaptiveCard\", \"body\": [ { \"type\": \"Input.Date\", \"id\": \"dueDate\" } ], \"actions\": [ { \"type\": \"Action.Submit\", \"title\": \"OK\" } ] } }, { \"type\": \"Action.ShowCard\", \"title\": \"Comment\", \"card\": { \"type\": \"AdaptiveCard\", \"body\": [ { \"type\": \"Input.Text\", \"id\": \"comment\", \"isMultiline\": true, \"placeholder\": \"Enter your comment\" } ], \"actions\": [ { \"type\": \"Action.Submit\", \"title\": \"OK\" } ] } } ] }";
for (var i = 0; i < 50; ++i)
{
await Task.Delay(1);
this.ContentControl.Content = null;
var card = AdaptiveCard.FromJsonString(this.card);
if (card != null)
{
var renderedAdaptiveCard = renderer.RenderAdaptiveCard(card.AdaptiveCard);
if (renderedAdaptiveCard != null)
{
this.ContentControl.Content = renderedAdaptiveCard.FrameworkElement;
}
}
else
{
await (new MessageDialog("Card was null", ":(")).ShowAsync();
}
await Task.Delay(100);
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
UWP Memory leak
i have a problem with UWP. I think there is a big memory leak problem in the views. The memory of the views...
Read more >Memory leak on UWP with target versions 10.0.17763.0 ...
In an UWP application when I set TargetPlatformVersion and TargetPlatformMinVersion to 10.0.17763.0, 10.0.18362.0 or 10.0.19041.0 (I keep ...
Read more >Solved: BUG: dwm.exe uses memory leakage with Intel HD ...
Solved: Hi, dwm.exe (Desktop-Window Manager) uses high memory with Intel Intel HD Graphics 630. This problem has been reported before:
Read more >Memory leak caused by viewport rendering?
The memory leak increases rapidly when I have something selected in the viewport. Deselecting the object by hitting ESC slows down the memory...
Read more >memory leak reporting - Syncfusion Essential Studio Enterprise
[UWP] Memory will no longer be leaked when using a memory stream as an image ... SfPdfViewer Added support for rendering the rotated...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey, @paulcam206. Are you able to be clear on why this P1 bug is this not on the roadmap? Is it because it’s been mitigated significantly and so is not considered a major issue anymore? Is it because UWP is not being supported going forward? Is it something else?
Thanks!
Addressing this issue is not currently on our roadmap, so closing. Please feel free to continue the conversation in this issue for future consideration.