MOG RIN Title Screen shows memory leaks

This script was found in a zip file that I got from somewhere (I don't remember and can't find again).


It needs these files
http://www.mediafire.com/file/irvxogj7512gv1i/Files.zip

During test play, with the console open. There are several entries regarding the skull image and title commands.
console.png

Is there anyone with enough ruby knowledge to see what is wrong and maybe fix it?

Thanks

Oops, forgot this image with the zip file.
Particles.png
You may ask to the author MogHunter (int the script header)
who can adress this issue.
I should have tried my tests first before posting this.

I think it's good now. I played around with different options (I look at whats in the script and try different things)
I added in 4 extra lines and now the messages do not show up.

Title commands dispose section
@com.each {|sprite| sprite.dispose }
@com.each {|sprite| sprite.bitmap.dispose }

Title Skulls dispose section
@skulls.each {|sprite| sprite.dispose }
@skulls.each {|sprite| sprite.bitmap.dispose }

SO now it looks like this
Code:
  #--------------------------------------------------------------------------
  # ● Dispose Commands
  #--------------------------------------------------------------------------               
  def dispose_commands
      @com.each {|sprite| sprite.dispose_sprites }
      @com.each {|sprite| sprite.dispose }
      @com.each {|sprite| sprite.bitmap.dispose }
  end 
 
  #--------------------------------------------------------------------------
  # ● Dispose Skulls
  #--------------------------------------------------------------------------               
  def dispose_skulls
      @skulls.each {|sprite| sprite.dispose_sprites }
      @skulls.each {|sprite| sprite.dispose }
      @skulls.each {|sprite| sprite.bitmap.dispose }
  end

This is now solved for me.
No this will provoke memory leak the script wasnt originally having memory leak its just print what its doing
Thanks for telling me.
I tested some more and it works with only the one line.
Code:
@com.each {|sprite| sprite.dispose }
@skulls.each {|sprite| sprite.dispose }
Does that make it better?
You dont need to modify the script
No this will provoke memory leak the script wasnt originally having memory leak its just print what its doing
The script got memory leaks, at least the one posted in the opening post surely does.
None of the Title_Commands and Title_Skull objects were disposed properly, which equals memory leaks.
Only their bitmaps are disposed, the objects themselves are not (and since their superclass is Sprite, they need to be disposed).
This wouldn't be the first time I find memory leaks in Moghunter's scripts, so it's really nothing unusual or unbelievable.

This should be the most efficient code to dispose everything properly:
Code:
  def dispose_commands
    @com.each {|sprite| sprite.bitmap.dispose; sprite.dispose }
  end
 
  def dispose_skulls
    @skulls.each {|sprite| sprite.bitmap.dispose; sprite.dispose }
  end
One iteration is enough, everything can be done inside that. And just to make sure everything goes right, always dispose the bitmap first, the object after that.

For the record, Moghunter's dispose_sprites method got nothing to do with disposing the actual Sprite object, it only disposes the sprite's bitmap. Basically, using sprite.bitmap.dispose is the same as using sprite.dispose_sprites.
@Sixth Thank you. Nothing shows up in the console, so I can only assume it's all good.

Original thread: https://forums.rpgmakerweb.com/threads/mog-rin-title-screen-shows-memory-leaks.79003/