First time here, thanks for giving the chance to ask tech questions directly !
I have an enterprise project (Blazor wasm) that needs to display several components (think each a different navigation page). Two of them need to display different graphic models (one is a graph, like in graph theory and the other is a model of pipes and connectors). I have used threejs, babylonjs in the past inside Blazor wasm, but I decided to go with pixijs this time because its high performance and how easy it is to make interactive 2D models on it (click, drag and drop, etc). I need to use user interaction. The models are super simple: graphic shapes like rectangles, circles, and just 1 texture (reused across). A Sprite to provide drag and drop functionality.
Unfortunately, I am getting a huge memory leak that goes from 200MB (Blazor app just loaded) to 4GB in a matter or minutes :-(( I thought that the leak came from Blazor repainting the components each time, so I did an override on the method that prevents repainting these 2 components.
In order to make this happen, I have a DIV element in each of those 2 components and I bind my graphic models on that DIV (via a getElementById and setting the content to the view of the 2D app).
I now know that the leak is not coming from Blazor wasm per se, but I would like to know if there are any good practices (like not adding a DIV (that will contain a canvas in the end, via WebGL). RIght now I do not even have a DIV to draw on, because the js library will create one (document.body.appendChild(app.view);
If I cannot fix this huge leak, I am ready to flush everything and try to use another graphical library. This is how desperate I am :((
Can you guys suggest me a native Blazor libray that uses WebGL natively (not Canvas) ? (hopefully not even using JS interop at all !!). I have seen Wave Engine, but I understand it is not 100% ready for web usage ?
I apologize for the super long post ! I can try to run a simple "dotnet new blazorwasm" and make a demo to reproduce the problem and upload it in a repo somewhere, to see if any of you can take a look and guide me better with the best practice for this particular use case !
Thanks in advance and best regards