question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[UWP][Memory] [Rendered Cards Leaking Memory]

See original GitHub issue

Platform

  • 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.

image

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:closed
  • Created 4 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
barryptakcommented, Jan 28, 2022

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!

0reactions
paulcam206commented, Jan 27, 2022

Addressing this issue is not currently on our roadmap, so closing. Please feel free to continue the conversation in this issue for future consideration.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found