V's Promotion System memory leaks

● ARCHIVED · READ-ONLY
Started by Roninator2 6 posts View original ↗
  1. https://forums.rpgmakerweb.com/index.php?threads/vs-promotion-system-v0-2.18875/

    Found this to have memory leaks and tried it in another demo and same results.

    Lines 597, 599, 601, 604, and 609. Basically every entry with window.new
    597 -> @promotion_header_window = Promotion_Header_Window.new(0, 0, Graphics.width, 75)

    Can someone help?

    In the meantime, I'll go back to watching ruby tutorials.
  2. How do you identify it has memory leaks? I've seen nothing unusual there. Neither global object reference from Mithran nor task manager shown anything unusual.
  3. I reduced my scripts down to 4 in a test project.
    leak1.PNG
    leak2.PNG

    Code:
    -----
    Time: 2018-11-06 17:20:34 -0500
    Memory Leak #<Promotion_Header_Window:0x13072b88>
    In Scene Scene_Map
    Creation Stack::
    Script 0125 -- Vindaka | Promotions, Line: 597:in `setup_promotion_windows'
    Script 0125 -- Vindaka | Promotions, Line: 582:in `initialize'
    Script 0006 -- SceneManager, Line: 60:in `new'
    Script 0006 -- SceneManager, Line: 60:in `call'
    Script 0125 -- Vindaka | Promotions, Line: 218:in `promote'
    (eval):1:in `command_355'
    Script 0040 -- Game_Interpreter, Line: 1411:in `eval'
    Script 0040 -- Game_Interpreter, Line: 1411:in `command_355'
    Script 0040 -- Game_Interpreter, Line: 197:in `execute_command'
    Script 0040 -- Game_Interpreter, Line: 103:in `run'
    Script 0040 -- Game_Interpreter, Line: 60:in `block in create_fiber'
    -----
  4. How did those windows even end up in Scene_Map? They should all be in V_Promotion_Scene. o_O

    And just when I finished writing that, I noticed that it says initialize in your stack records...
    That very first method in the V_Promotion_Scene class should be called start, not initialize.
  5. Was gonna type stuff, but Sixth pointed out the important part.
    In short, it's a false positive.

    Global object reference recorded any window / sprites created.
    And those windows get created when the scene is about to change (not after it). Marking it "hey it isn't yet disposed during the change from scene map to promotion!". But in the end, window is disposed after the scene change from promotion to map.
  6. Well thankfully it was easy for someone. Thank you @Sixth and @TheoAllen
    Changing the scene from initialize to start stops the messages from showing up, so it looks like it's fixed.
    Big Sigh...