Am I double loading my images?

BlitzMax Forums/BlitzMax Programming/Am I double loading my images?

Bukky(Posted 2006) [#1]
Hey guys,

I've been working on my game for some time now, and I've noticed that it uses up huge amounts of RAM when running. On my hard drive, I have about 14 MB of PNG's. Now I realize that they uncompress when they are loaded, but I was wondering if the excessive amounts of RAM my game uses may have to do with the way I'm loading those PNG's and setting up my in-game animations.

Basically, the setup goes like this:

Global char_idle_strip:Timage=LoadAnimImage("images/charidlestrip.png",265,371,0,3)
Global charIdleAnimation:BAnimation = New BAnimation 
charIdleAnimation.InitValues(char_idle_strip, 4, "0,1,2,1", 200)
charAnimation.SetCycle(1) 


The parameters to charIdleAnimation.InitValues are (an_image, number_of_animation_frames, a_list_of_frames, time_in_ms_between_frames)

There is a field in the BAnimation type which is set equal to an_image. When this happens, is there a duplicate in memory of the an_image file?


tonyg(Posted 2006) [#2]
Don't think so.
What probably is happening is your 1060*371 image is being increased to 2048*512 to satisfy the ^2.
Not sure whether each frame will also be 512*512 as well.


Bukky(Posted 2006) [#3]
So when I do this:

Global char_idle_strip:Timage=LoadAnimImage("images/charidlestrip.png",265,371,0,3)

Global Char_idle_strip2 = char_idle_strip


Chari_idle_strip2 just referances char_idle_strip?


FlameDuck(Posted 2006) [#4]
Chari_idle_strip2 just referances char_idle_strip?
Yes.


tonyg(Posted 2006) [#5]
Yep, they both point to the same object.


Bukky(Posted 2006) [#6]
ok thanks :) resizing my images now!