Need help inspecting memory leak

0 favourites
  • 1 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I need tools for inspecting memory leak in my app.

    I am developing an app with r173, and I see that it got some sort of memory leak in node webkit. After some more investigation, I somehow have a feeling that this actually could be Chromium engine's fault. But I am not sure yet.

    I have used Performance Monitor to see the growth of memory of my app when using Node Webkit, Chrome, and Firefox:

    These 2 graphs here are Chrome. The memory just keep on shooting up. Node Webkit starts out consuming lower memory but it also keeps on increasing no different than Chrome. Obviously, they used the same engine.

    On another instance, I have also monitor for 15 mins and you can see that it already shoots beyond 500K mem.

    This graph below is Firefox. It fluctuates a lot, but memory consumption seems to come back down to a reasonable size. The huge spike there was caused by me rapidly restarting the same layout over and over. I did the same to Chrome, but it does a little longer for the curve to come back down. (not shown here)

    I have tested that if I stay still in a layout and didn't change layout at all, memory would stay in the reasonable range. When I change the layout and stay still in the new layout, somehow memory gradually starts increasing. I have been trying to reproduce the memory leak on a smaller scale capx, but I couldn't reproduce it at all for the passed few days.

    So I have been trying to narrow down what could cause this in my app. One of them is that if I add several keys into a Dictionary on start of layout, a leak would occur, if I restart layout several times. (memory gradually going up) I have tried disabled that dictionary out, and doing nothing in one layout, and restarting layout several times, I see that memory goes up and down ok, and not gradually going up. I tested this for several times, and I got more or less identical results. However, when I change to another layout, I see memory gradually going up again. It still goes up even no new objects are created. I see the graph rises up slowly as if something new is created and added to the memory all the time.

    Here is one of my tests: I have created an empty layout with only one event that allows me to get back into the game. There are no objects at all, except for... maybe global dictionaries/arrays. I got the following test result:

    a. starting out in layout A. Doing nothing. Memory dropped.

    b. change to layout B. Memory rising cuz of new objects, etc. memory still dropped down a bit.

    c. change to blank layout. Memory dropped twice.

    d. change back to layout A, and restart the layout about 10 times.

    e. change to blank layout again.

    f. change back to layout A.

    From e. onward, you will see that memory keeps on slowly increasing non-stop.

    Could this mean Garbage Collector is too slow to collect garbages? The gradually increasing graph does imply that some culprits are not freed and accumulating. But the result from e. and f. also made me worried and wonder whether Garbage Collector stopped working entirely. I used to see my app went up to 800 MB and still increasing, in just an hour or so. At that time, the game starts to stutter a bit at ~50 fps instead of flawless 60 fps.

    Whatever the case, I am looking for a tool to inspect which component(s) could cause memory leak. This is difficult to report to the node webkit and chrome folks because I could not reproduce this on a smaller scale capx. If I could know which component does this, I could create the capx and export the node webkit to the developers.

    Ashley, do you appear to know any tools or the like? Any help is appreciated.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)