Again with memory on iPhone and liberating memory

Previous topic - Next topic

ampos

My app on the iphone works that way:

-load a bunch of sprites
-load&play music
-intro
-game

The intro is as follow:

-load 2 fullscreen images (loadsprite 1,"image1.png" loadsprite 2,"image2.png")
-play with the sprites
-"unload" both sprites (loadsprite 1,"nanana" loadsprite "nanana",2)

On the iphone4 it runs fine. But on 3G & 3GS, it start running and the fps is at 2-5, run for a second or 2 and crash.

If I skip the intro, all runs fine.

Is this normal or something else? I though that if there was not enough memory it would crash while loading, not after, and playing...

ALso, my "unloading" method seems not working...


ampos

Code (glbasic) Select
loadsprite 100,"...."
loadsprite 101,"..."
...
loadpsrite 200,"..."

playmusic "music.mpg"...

loadsprite "huge1.png",1
loadsprite "huge2.png",2
loadbmp "back.png"
for a=-0.01 to -1 step -0.01
  alphamode a
  drawsprite 1,0,0
  showscreen
next
for a=-0.01 to -1 step -0.01
  alphamode a
  drawsprite 2,0,0
  alphamode -1-a
  drawsprite 1,0,0
  showscreen
next
loadsprite 1,"nothing";loadpsprite 2,"nothing"

game:


More or less

=D

Kitty Hello

how big are the images?
You have 4 bytes per pixel. so calcualte:
4*width*height, where width and height have to be extended to the next power of 2 dimension!

ampos

480x320.

The thing that surprise me is that the app runs for a second or two. I though that if no more memory was left, it crashed in the loading instructions, not after that.

Oh, and in the iphone they are the same exact number of images, but x4 size. Has the iphone x4 more memory than 3G/S?

(at the start of the program I use setbox "480.sbx" or setbox "960.sbx" for loading the images)

XanthorXIII

iPhone4 has 512 Megabytes of Memory vs the 128 Meg on the Original 3G and 256 3GS
http://en.wikipedia.org/wiki/Iphone
Owlcat has wise