We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello Enrico,
I re-create the charts on demand and I have some memory leaks because some references must be disposed (I am not an expert on this issue).
1.- moduleTask in ChartjsInterop:
public async ValueTask DisposeAsync() { if (moduleTask.IsValueCreated) { await (await moduleTask.Value).DisposeAsync(); } }
2.- JsModule and dotNetObjectRef in Chart.razor. :
protected override async Task OnAfterRenderAsync(bool firstRender) { try { ... dotNetObjectRef?.Dispose(); dotNetObjectRef = DotNetObjectReference.Create(Config); JSModule ??= new ChartJsInterop(JSRuntime); .... } catch (ObjectDisposedException) { // Sometimes the object reference is released but JS invoke some event. } }
public async ValueTask DisposeAsync() { dotNetObjectRef?.Dispose(); dotNetObjectRef = null; if (JSModule is not null) { await JSModule.DisposeAsync(); JSModule = null; } }
Let me know what do you think :) Thank you, Gaston
The text was updated successfully, but these errors were encountered:
Thank you Gaston. I'll add those suggestion in my next release. Enrico
Sorry, something went wrong.
erossini
No branches or pull requests
Hello Enrico,
I re-create the charts on demand and I have some memory leaks because some references must be disposed (I am not an expert on this issue).
1.- moduleTask in ChartjsInterop:
2.- JsModule and dotNetObjectRef in Chart.razor. :
Let me know what do you think :)
Thank you,
Gaston
The text was updated successfully, but these errors were encountered: