Memory Usage - Other?

tripleehentertainmenttripleehentertainment Member Posts: 52
edited November -1 in Working with GS (Mac)
Hey there. I'm working on a fairly simple game.

My memory usage for sounds is typically 1mb, for images under 8mb, and for the game engine around another 8mb. However I'm getting over 40mb in the "other" category!

What exactly affects the "other" category so I know what I should change?

Thank you!

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    How many Actors are you using?
  • tripleehentertainmenttripleehentertainment Member Posts: 52
    In total I have 39 actors.

    Now those aren't all on the stage - those are just my total amount of prototypes.

    Even on my splash screen scene, where I have 1 actor - my logo, and I play 1 sound (which is less than 100kb) I get 35+mb in the "other" category.
  • tripleehentertainmenttripleehentertainment Member Posts: 52
    Can anyone fully describe what "other" denotes?

    It's obviously not actors or rules. Refer to my previous post ^.
  • synthesissynthesis Member Posts: 1,693
    Its probably audio...are your audio files compressed/optimized?
  • tripleehentertainmenttripleehentertainment Member Posts: 52
    As I previously mentioned, audio is only taking up a maximum of 1mb of memory.

    There are 3 sections in the "memory" department. Audio, images, and other.

    All I need to know is what "other" encompasses.
  • ckck Member Posts: 224
    It's not audio. I have a game with over 50 MB in the 'Other' category. That's more than half od the game, and It's only a 1.5 MB project.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I see I thought it was the amount of Actors back then too...
    It could also be the amount of Rules? Or Scenes?

    I would make a duplicate version of your game.
    Start chopping things out one by one and run a test in the GS Viewer after each thing eliminated. That will help you find the culprit.

    Good luck!
  • specialist_3specialist_3 Member Posts: 121
    firemaplegames,

    I am having issues with my game too. I noticed that the total memory keeps increasing over time and by 2-3 mins the game crashes. At that point, the memory has reached 47.6mb. It starts are around 23mb. This is a big problem I am facing now.

    Has this got to do with the constant spawning I have in my game? We did discuss about how FPS drops with spawning too many actors but mine has not dropped below 31 fps despite constant enemy spawning and multiple bullets spawning. Does this mean its high time I swapped to the "pre-spawn everything and move dead creeps offscreen" algorithm? But even if I do spawn, if I destroy it correctly, does it still cause memory leaks?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Yes, spawning actors will increase the RAM each time.

    At 45MB or so the device will crash.

    You need to recycle everything to pull it off. That goes for creeps as well as bullets. Explosions, everything...

    You could just target the iPad or iPhone4, but on yhose older devices, its brutal.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Do a quick test. Manually drag copies of ALL the Actors into the Scene. All 50 creeps, 50 explosions, 300? bullets...

    And then run it on the device. That will give you an idea of what the game can handle.

    Or use display text to keep track of all the stuff you spawn and note when it gets near 40mb or so...
  • design219design219 Member Posts: 2,273
    firemaplegames said:
    Yes, spawning actors will increase the RAM each time.

    You mean you don't get it back when you destroy a spawned actor?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    No. Only changing the scene seems to flush it.
  • design219design219 Member Posts: 2,273
    firemaplegames said:
    No. Only changing the scene seems to flush it.

    Oh, that explains something. On my newest game, I've got small actors that are repeatedly destroyed and respawned. I've had a complaint about crashes that I couldn't understand, so that may be the issue.

    These actors respawn off stage, so if I just moved them instead of destroy and respawn, that should help. Thanks for the info!
  • hrsmediahrsmedia Member Posts: 522
    So instead of destroying actors, I change the actor's alpha to 0 and use move to position?
  • reddotincreddotinc Member Posts: 653
    Someone please explain to me why destroying an actor does not remove it from RAM.. This is one of the most ludicrous things i've ever heard!!!
  • design219design219 Member Posts: 2,273
    reddotinc said:
    Someone please explain to me why destroying an actor does not remove it from RAM.. This is one of the most ludicrous things i've ever heard!!!

    Yeah, this kills me. I never knew. My first game has two game modes, the second beinig just a non-stop string of enemies coming out and I have them destroyed and respawned for as long as a player can go. I've never gone for more than 10 minutes because I didn't see the need, but I can see now that this issue would sure crash older devices.

    I had no idea. But now I think I can go into it and put a periodic break to another scene to clear this up, but if I had known before...

    _______________

    Nesen Probe http://itunes.apple.com/us/app/nesen-probe/id377766693?mt=8
    Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
    Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
  • reddotincreddotinc Member Posts: 653
    we shouldn't have to do that.. it's just crazy.. the actor is DESTROYED..

    The game I am making now is an endless game and this is VITAL.. Gendai?
  • design219design219 Member Posts: 2,273
    Okay, I've just been test two of my game and I'm NOT finding a memory problem with spawning and destroying actors. I'm still on .8.7

    I played for many minutes of constant spawning and destroying and the memory fluctuated a bit, but stayed within a couple megs of the same size.

    Where did this notion about spawning and destroying blocking up memory come from?

    _________________________________

    Nesen Probe: Is this the single most unappealing game in the history of GameSalad? I can't seem to give it away! Anywhere. But if anyone want's to try it out, codes are still available! http://gamesalad.com/forums/topic.php?id=8097
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hmmm... well that is hopefully good news!

    Can you try a test for me?

    Just try spawning an Actor that has a 1024x1024 .png in it. It can be any graphic. You can just make a big gray box in Photoshop, anything. And make sure it isn't scaled, but actually 1024x1024.

    When it gets spawned, the image usage RAM should jump up by 2MB.

    When you destroy it, hopefully it should then drop by 2MB.

    The same thing if you want to add sound effects to that Actor. The audio RAM should rise by the size of the .ogg file.

    It always seems to just keep climbing for me. The RAM doesn't get relinquished until I Change Scenes.

    0.8.7 is fine. It happened then for me too.

    I'll also run some tests myself.

    If you notice it drop back down, that would be awesome! Maybe I have the setup in my game incorrect, and it's not destroying the Actors properly.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Unfortunately, I NEED to spawn them in mine, not just move them... because if they get shot... they are destroyed and won't move!
  • firemaplegamesfiremaplegames Member Posts: 3,211
    OK,

    Here's my results...

    I made a dummy test .png in Photoshop. It is 1024x1024

    In the first test, I made two Actors in the Library. The first Actor has a simple Rule:

    When Mouse is Down
    Spawn Actor 2

    Actor 2 has my .png image in it. And a Timer that destroys itself after 3 seconds.

    I drag actor 1 out into the Scene and test it. Interestingly, the image RAM is now already at 2MB - even though there is just a plain white box in the Scene with no graphics.

    Tapping the screen spawns Actor 2 and the RAM does NOT increase - but it is already at 2MB. Apparently GS goes through all the Rules and pre-adds any spawned images to RAM automatically - whether you decide to spawn them or not.

    When the Actor gets destroyed in seconds, the RAM does NOT go back down for me.

    Test #2

    In this test, I just have 1 Actor with no graphics - just a plain white box.

    And in this case, I use a Change Attribute to change its image, like this:

    Rule
    When Mouse is down
    Change Attribute: self.Image To: "test.png"
    and then a 3 second timer to destroy itself

    Now when I run the test, the image RAM is correctly at 0K. When I tap the screen, NOW it jumps up to 2MB. This is what I expect. When it destroys itself, the RAM is not freed up for me.

    I am using the second method in my game, Changing the images when I need them. This way it only adds to the RAM total when I actually use the image. But in both cases, the RAM never drops for me.

    If you can help me figure out a solution to this, that would be sooooooo awesome!

    Joe
  • AfterBurnettAfterBurnett Member Posts: 3,474
    That seems really dumb. I would have thought that clearing RAM properly would be one of the fundamentals of coding... why does GS not do it? No wonder BASIC 2D GAMES run slowly on an iPod Touch 8GB... funny as I can run the latest 3D stuff on it...
  • design219design219 Member Posts: 2,273
    Joe,

    Sorry, I've been out of town all day. I'll try some more testing tomorrow. I'm wiped out tonight. This would be great to get figured out.

    _________________________________

    Nesen Probe: Is this the single most unappealing game in the history of GameSalad? I can't seem to give it away! Anywhere. But if anyone want's to try it out, codes are still available! http://gamesalad.com/forums/topic.php?id=8097
  • pokblueskypokbluesky Member Posts: 9
    So, what is the conclusion about other memory usage ? I am facing it right now.. Anyone?
Sign In or Register to comment.