Thanks to visit codestin.com
Credit goes to github.com

Skip to content

In Blazor/Wasm VS2022(17.12.1) Memory Leak in Processing program between switching pages #61607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vsfeedback opened this issue Apr 22, 2025 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
In SkBitmapService
public class SkBmpService : ISkBmpService
{

public SKBitmap[] TaigyImgs { get; set; } = null;
public SKBitmap[] SkyImgs { get; set; } = null;

string Directory = string. Empty;

public SkBmpService()
{
TaigyImgs = null;

Directory = "/Images/";
}

public async Task LoadBackImages(HttpClient Http)
{
string BkName;
string DirName = Directory + "HbkViews/";
string[] SkyIDs = new string[12]
{ "HGsky4.png", "Hsky4.png", "GreenYellow2.jpg", "DarkBlue.jpg", "Hsky2.png",
"Color4.jpg", "Green1.jpg", "Green2.jpg", "HGsky3.png", "HGsky1.jpg",
"Color2.jpg", "Hsky30.jpg" };
SkyImgs = new SKBitmap[12];

for (int n = 0; n < SkyIDs.Length; n++)
{
BkName = DirName + SkyIDs[n];
//System.IO.Stream stream
//using (var stream = await Http.GetStreamAsync(BkName)) { }
var stream = await Http.GetStreamAsync(BkName);
SkyImgs[n] = SKBitmap.Decode(stream);
}
}

}

(1) ------------------------------------------- In SkBmpService.cs...... the SkyImgs[10] 's memory is OK

Ok1.png

(2)---------------------------------------------- In Home.razor.cs......
@code {
//By default, when false, the canvas is resized to 1 canvas pixel per display pixel.
//When true, the canvas is resized to device independent pixels, and then stretched to fill the view.
SKCanvasView? skiaView = null!;

protected override void OnParametersSet()
{
SkBmpSvc.LoadBackImages(Http);
}

void OnPaintSurface(SKPaintSurfaceEventArgs args)
{
SKImageInfo NewInfo = args. Info;
SKSurface surface = args. Surface;
SKCanvas canvas = surface. Canvas;

canvas. Clear();
canvas. DrawBitmap(SkBmpSvc.SkyImgs[0], new SKRect(0, 0, NewInfo.Width, NewInfo.Height));
}
}

SkyImgs[0] Is Ok, The SkBitmap is displaying
Ok2.png

But the SkyImgs[10] 's memory is leaking
Error3.png

(3)-------------------------------------------- switch In CastCoin.razor.cs......
The SkBitmap[3] will not be displayed
Error5.png

But the SkyImgs[10] 's memory is leaking
Error4.png


Original Comments

Feedback Bot on 11/25/2024, 02:31 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Wang Samuel on 11/26/2024, 08:05 AM:

(private comment, text removed)

Feedback Bot on 3/6/2025, 06:01 AM:

We detected that this issue hasn’t received a lot of activity, votes, or comments in the past 90 days. Based on this, the issues severity and affected area, it’s my experience that this issue is unlikely to get fixed. To improve the situation, consider following best practices for quality problem reports, and giving us more details on how this issue is impacting you.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Apr 22, 2025
@dotnet-policy-service dotnet-policy-service bot added the Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. label Apr 22, 2025
@javiercn
Copy link
Member

Thanks for contacting us.

Please make sure you test your app using the Release environment and without debugging enabled. You'll also have to trigger a Gen 2 compacting GC using GC.Collect as when the GC runs in serve mode it won't release memory unless it needs to (which is not a memory leak).

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Apr 22, 2025
Copy link
Contributor

Hi @@vsfeedback. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@gfoidl gfoidl added area-blazor Includes: Blazor, Razor Components and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Apr 22, 2025
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity
Projects
None yet
Development

No branches or pull requests

3 participants