Code Monkey home page Code Monkey logo

Comments (9)

not-fl3 avatar not-fl3 commented on May 30, 2024

I did run into an issue with it too though, crashing my entire system with itself.

Can confirm :( My system ran out of ram after couple of minutes with the tab opened.

from good-web-game.

not-fl3 avatar not-fl3 commented on May 30, 2024

Still no idea whats going on, but at least I found a way to profile it without crashing my system :)
With the super narrow window it stop rendering and memory stops leaking for some reason.
screen

from good-web-game.

not-fl3 avatar not-fl3 commented on May 30, 2024

Just noticed a lot of errors in the console:

Error: WebGL warning: texImage2D: Requested size at this level is unsupported. game.js:643:388
Error: WebGL warning: clear: Framebuffer not complete. (status: 0x8cd6) COLOR_ATTACHMENT0Attachment has no width or height. game.js:703:92
Error: WebGL warning: clear: Framebuffer must be complete. game.js:703:92
Error: WebGL warning: drawArrays: Framebuffer not complete. (status: 0x8cd6) COLOR_ATTACHMENT0Attachment has no width or height
...
Error: WebGL: No further warnings will be reported for this WebGL context. (already reported 32 warnings)

from good-web-game.

maciejhirsz avatar maciejhirsz commented on May 30, 2024

@not-fl3 thanks for this! What version of Firefox are you running? I don't see any errors in the console here, I guess iOS safari might suffer from the same issues around FBOs.

from good-web-game.

not-fl3 avatar not-fl3 commented on May 30, 2024

Oh, my bad, the errors was the result of insufficent window size :(
Also an issue I suppose, but not the one we are looking for.

from good-web-game.

maciejhirsz avatar maciejhirsz commented on May 30, 2024

Ah, that makes sense. Non the less, the memory leak sounds like something that should be possible to track.

from good-web-game.

maciejhirsz avatar maciejhirsz commented on May 30, 2024

Mostly just guessing here, but it looks to me like video ram is leaking, when I look at processes nothing is happening, but the actual memory usage shows a pretty standard GC saw pattern - things go up and down by 2 GB every few seconds in the system monitor:

Zemeroth is showing a completely flat line, so I'm 80% sure that framebuffers (or rather how I'm using them to emulate the Canvas api from ggez) are the culprit here given the rate of bloat.

Edit: same is happening on Chrome, I guess Chrome GC might actually clear all memory vs Firefox cleaning most but not all of it, leading to a crash after couple minutes.

from good-web-game.

maciejhirsz avatar maciejhirsz commented on May 30, 2024

DUH!

This is actually related to #14. I have to recreate my main Canvas when the screen is resized, but for some reason I figured it would be a good idea to do it as a part of draw instead of resize_event, and to do that I've also employed a dirty flag to inform the draw loop when it needs to create a Canvas with a new size. I hate dirty flags but sometimes they are useful. Anyway, everything works fine, except..:

        if self.canvas_dirty {
            graphics::clear(ctx, [0.0, 0.0, 0.0, 0.0].into());

            self.canvas = Self::create_canvas(ctx, self.canvas_size)?;
        }

I never actually set the flag back to false 🤦‍♂️. Since creating a new Canvas creates a new Texture, and Texture is a leaky abstraction (in both meanings of the word, as per #14) this creates the leak on every frame.

Edit: deployed new .wasm with a fix :P.

from good-web-game.

not-fl3 avatar not-fl3 commented on May 30, 2024

Glad you figured it out!
New version works fine in firefox :)

from good-web-game.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.