GS 0.8.9 Game Engine Memory Leak

2

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Sure.

    I was just wondering how it played on your actual device when not using the viewer.

    I know you can't see all the info, but maybe it would give you a good feel for how it performs in real-world conditions?

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • smc1979smc1979 Member Posts: 48
    I had instruments attach to it and the cpu went to a max of 88% and memory to a max of 36mb. Every time I change or reset the scene the memory cleaned up and the cpu lowered.

    Besides slow load times it worked just fine and not a single leak that instruments could find.

    If after more testing this is true, and I spent all this time trying to find a leak that isn't there because the viewer is just buggy I may need to hit something :-)

    -Shane
  • smc1979smc1979 Member Posts: 48
    Well after more testing turns out the leak is in the final game as well. but no where near as bad as the viewer.

    Memory climbed to 75mb before crashing. And the crash was the game freezing and I had to kill it.

    What is odd is the memory didn't start to climb till I loaded the scenes with rotating actors. After that the memory would keep trying to clean itself but would never go back down to what it was. Even when I go back to scene without rotating actors it still does it. But all scenes before it would be fine till rotating came in.

    But again I am not going to waste any more time trying to fig that one out.

    Point is the finished game behaves much better than the viewer. Even though there is still a leak. I will keep an eye on GS and when updates come out I will get my game updated and released.

    So I will release the game as is for now. Fingers crossed, wish me luck :-)

    -Shane
  • synthesissynthesis Member Posts: 1,693
    This is interesting SMC,

    We removed the collisions and still had memory problems. I too have found problems in both adHoc and viewer.

    Interesting that you mention rotation. I too am using rotate to position in most of my actors to point them to their seek targets.

    I agree that GS has an internal memory issue. Hopefully Gendai will read this thread and look into both collision and rotation. Perhaps those are the keys to this issue.

    Also...I would be careful to not release the game to iPod 2G or iPhone 3G or lower as those memory allowances are too low right now to risk the apps to freeze. If you issue the game before the bug is fixed...I recommend to limit the downloads to faster devices...and save yourself from a slew of 1 star ratings.

    I have an email address to one of the coders that requested my game... I will forward him a link to this thread. Hopefully they will take notice.

    [ EDIT ]
    Here is what I sent them:

    I wanted to send you this email to point you to this thread if you haven't seen it already.

    A couple other devs are experiencing similar issues as we are having. We have done some testing and think we MIGHT have it narrowed to either collisions or rotation behaviors or a combination of the 2. But without better memory reporting and a lack of input/direction from Gendai...its hard for us to tell from our side.
  • smc1979smc1979 Member Posts: 48
    Releasing my game now, and currently it is only for the iPad, so if the game does well I will do a iphone version.

    Im not sure how many people are going to like this game, it is only my first. But only time will tell.

    To bad the ipad versions don't work on the web part or I could get your feed back :-)

    -Shane
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Yep. We're reading it. Thanks.
  • synthesissynthesis Member Posts: 1,693
    Received this via email from Gendai in response to our thread and my email to them (above):
    Thank you very much on that. It will help a lot.

    Hopefully they will get to the bottom of this.
  • chosenonestudioschosenonestudios Member Posts: 1,714
    synthesis said:
    Received this via email from Gendai in response to our thread and my email to them (above):
    Thank you very much on that. It will help a lot.

    Hopefully they will get to the bottom of this.

    Wow, sounds good!
  • smc1979smc1979 Member Posts: 48
    I just released my game, so my game is on my account, they are more than welcome to use it to help find the leak :-)

    -Shane
  • thevelopersthevelopers Member Posts: 21
    We are having the same problems with GS. It's frustrating how the game crashes after a certain time, and it doesn't use any collision, just interpolation, timers and move behaviors. We didn't test the ad hoc or the final build yet, just the development build. The .gameproj file is about 4,1 MB, images 1,2 MB and sounds 514 KB. The test on the iPod Touch crashed like the GS preview. The other test, on GS viewer (with iPhone Simulator), showed FPS under 20 and memory usage over 150 MB! Can someone help saying what tests we should do? Thanks!
  • expired_012expired_012 Member Posts: 1,802
    150mb of ram! That's a ton. You really have to reduce that a lot! By a lot I mean reducing it by 70-100mb
  • smc1979smc1979 Member Posts: 48
    For me, from the tests I ran is the viewer is still buggy. And the memory usage is not correct in it.
    You will notice it never cleans up the game engine memory. But when I complied the game and ran it without the viewer the memory was much better at being cleaned up. There was still a memory leak, but no where near as large as with the viewer. So granted there was still a leak, it still took 2x - 3x longer for the game to crash than it did in the viewer.

    Non the less the leak is there. But the viewer has its own problems, and for now on I don't trust the viewers memory output, I will test with complied games instead :-)

    -Shane
  • thevelopersthevelopers Member Posts: 21
    Shane, how can you see how much memory is used without testing with the GS viewer?
  • smc1979smc1979 Member Posts: 48
    Once I am done with the game and ready to test how its memory does I upload the game to GS and have it complied. Then I transfer it to my iPad or iPhone) then I open the application "instruments". I then have it watch all the resources as I play the game. Its a much better way of testing your app for memory and cpu usage.

    -Shane
  • smc1979smc1979 Member Posts: 48
    Sorry, double post.

    -Shane
  • reddotincreddotinc Member Posts: 653
    I'm going to test our upcoming game using instruments tomorrow and test the difference between that and the viewer. I'll post the results after.

    // Red Dot Inc
  • thevelopersthevelopers Member Posts: 21
    That "instruments" is the Xcode's one or an app for the iPhone? If it is the Xcode app, how can you connect the device with it and don't use the GS viewer? Thanks!

    Some facts now. Testing my game on the GS preview I can see smooth playing, but not with GS viewer and the iPhone Simulator. On the main menu screen, where it has only one interpolation, one animation and some move behaviors, the numbers displayed are:

    Frames per second: 12 (average)
    Images: 13.9 MB
    Sounds: 0 KB (and I know i'm not deaf, 'cause there's music playing and a button sound when clicked)
    Game Engine: 5.2 MB
    Other: 58.4 MB
    Total: 77.5 MB

    Would I maybe notice a huge difference testing on a real iPhone? These numbers are ridiculous! When I play the game, the FPS lowers and playing is almost impossible, until it crashes...
  • thevelopersthevelopers Member Posts: 21
    I googled now for instruments and the iPhone device and discovered how to do it. Anyway, thank you, Shane. But i'm still intrigued with this numbers GS viewer showed.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    How many actors are in your Scene?
    How many actors are in the Library?

    Are you able to chop out actors and see if one is causing problems?

    If you want, you can send me your file and I will take a quick look at it and see if I see anything.

    joe at firemaplegames dot com.
  • thevelopersthevelopers Member Posts: 21
    In this scene (main menu) there are 25 instances of actors. There are 34 actors in the library and 10 are being instantiated in the scene.
  • smc1979smc1979 Member Posts: 48
    thevelopers said:
    That "instruments" is the Xcode's one or an app for the iPhone? If it is the Xcode app, how can you connect the device with it and don't use the GS viewer? Thanks!

    Some facts now. Testing my game on the GS preview I can see smooth playing, but not with GS viewer and the iPhone Simulator. On the main menu screen, where it has only one interpolation, one animation and some move behaviors, the numbers displayed are:

    Frames per second: 12 (average)
    Images: 13.9 MB
    Sounds: 0 KB (and I know i'm not deaf, 'cause there's music playing and a button sound when clicked)
    Game Engine: 5.2 MB
    Other: 58.4 MB
    Total: 77.5 MB

    Would I maybe notice a huge difference testing on a real iPhone? These numbers are ridiculous! When I play the game, the FPS lowers and playing is almost impossible, until it crashes...

    You memory climb is in "other" where as mine was in the game engine. You may have to cleanup some things to get that down.

    One thing in my testing was I never had any trouble with the "Other memory" only the game engine.

    -Shane
  • thevelopersthevelopers Member Posts: 21
    So... any ideia on what is using so much memory on "other"? I think this name is not very intuitive. And there is nothing more to "clean up", since my images are all reduced to small KBs and i've deleted all of the "my behaviors" and useless actors and images as well. The whole project is under 5 MB.
  • smc1979smc1979 Member Posts: 48
    When I was testing I found the rules and things happening causing it to grow. But what you could have causing it to grow that big I don't know. Could be yet another leak :-(

    Shane
  • quantumsheepquantumsheep Member Posts: 8,188
    I'm updating my free Xmas comic from last year.

    Added in a 'page turn' anim (courtesy of t-shirtbooth) and split the pages (68) into two different scenes (in the hope the main scene would load faster - it does. A bit. But then you have a wait in the middle for it to hop to the next scene!).

    Anyway, I wanted to check it still works on a 1st gen iPod Touch (it does!).

    The main menu and the 'credits' page use up around 7mb each - no great shakes there.

    I started the comic and it took a while to load the next scene in.

    This started at around 30mb - rising to 35 as I chaged images (pages)

    The change scene in the middle dropped the memory usage to 34mb, but this rose to 35mb.

    Second and third time reading through the two scenes with the actual comic in it stayed at 34.8mb - i.e. it had gone *down* and stayed stable.

    I don't know if that's very interesting.

    What I *did* find interesting is that when testing the very same app on a 3Gs, I got different memory useage.

    start screen and credits started at 10.3mb

    Going into the comic raised it, as expected, but to 40.9mb - more than 5mb more than on the 1st gen touch.

    This then rose again as I flicked through the pages to 47.6MB. That's over 10mb more than on the 1st gen touch.

    Changing scenes to the second part of the comic took the memory down to 41.5 - again, more than the ipod touch test. It then quickly rose to 48mb.

    Going back to the menu/credits screens, the memory usage had risen to 11.4mb.

    Going through the comic again, it stayed at a steady 48mb and continued to do so.

    It's important to note that this is just a comic. There are no moving actors. There is only one animation (the page turning). There are only a maximum of four buttons you can interact with on any scene.

    I'm not sure if this will help. But I found it odd that the same app could be giving different memory readings on different devices.

    If I'd tested it on just my 3GS, for example, and noted that the memory use went above 40mb, I may have chosen to abandon the 1st gen ipod touch version and made it 'arm7' only.

    Hope that helps in some way,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • firemaplegamesfiremaplegames Member Posts: 3,211
    I actually just found my first memory leak last week...

    The Play Sound was leaking going back and forth between Scenes (I have a button click sound).

    I sent a sample file to CodeMonkey that had the memory creep.

    He said that he was using the latest internal build, and that he could not replicate the leak. He said that they had found and fixed a leak from 0.8.9... Hopefully this will fix my issue as well as some of the ones others are reporting.
  • quantumsheepquantumsheep Member Posts: 8,188
    That's great news, Joe :D

    Edit:
    But I wonder how accurate the memory readings are if there are two different readings for two different devices as I outlined previously.

    I absolutely LOVE the viewer and test on it all the time. If it's inaccurate then I'd hope that gets fixed :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • jessicaleahyjessicaleahy Member Posts: 144
    At the present, I am no expert on memory leaks but I will not be shocked that at times resources in use are identified as "memory leaks". I would not fret about the "leaks" except if they are still identified and when they are supposed to have been freed; eg. When you close the app.
  • DjangoZDjangoZ Member Posts: 40
    We just watched the free WWDC sessions today on the memory leak and time profiler instruments, they are excellent. If you are a paid app developer you can get them here:

    http://developer.apple.com/videos/wwdc/2010/

    Recommended sessions:
    - all of 131
    - 401 & 402 (especially 402)
    - first 10-20 minutes of 309 & 311

    they're all pretty good, but those were most helpful to us on game development.
  • DjangoZDjangoZ Member Posts: 40
    firemaplegames said:
    GS slows down for everybody after a few minutes. I literally quit and reopen GS every minute.

    Wow. I'm just getting back into GS after using iTGB for the past 7 months. I'm a little stunned at how often it crashes. Huh.

    It's an amazing tool, but...do I have the patience for this?
  • vegasmike1vegasmike1 Member Posts: 192
    I am not a programmer, but on the last game I submitted, Robosaurus, it got rejected in like 5 minutes into the review. I was bummed, so I sent GS the project, they had no problems, I had tested on Ipad, and 3GS, as well as two Itouch devices. It worked fine, with the adhoc version, so I freaked a bit, and I think most GS users would as most are not programmers, I think. Anyway, I was watching the game in the viewer, trying to make sense of it all and playing it on the itouch, the very first scene is a logo screen with a sound, a tiny sound but it seemed on load that the sound took a long time to load, much longer than it should. So I took the sound out of the startup screen, resubmitted the app after a recompile at GS and it was approved in two days. Again not a programmer but I think that possibly SOUND is a real issue, unlike an animation, sound has to be a constant, and the ogg file format is crap, or at least the files I get from using Audacity. I went back and for the heck of it took out all sound from the game, memory seemed more stable, and did not grow at some crazy rate. If the sound is used, and looped that memory I think is getting bloated, it uses the file, then I think (think) loads it again and uses it again and so forth and so forth. I took a few of the actors out of the scenes and put them in a new project file with NO sound, very stable.
    So for you wizards of code, maybe this will trigger something.

    In defense of GS, Codemonkey has been very helpful and has responded as fast as he could. I dont think these guys are doing nothing, but the code says BETA, I am sure they know they have issues, and these issues have probably been in all the games made with GS. In my biz, we have to fix BUGS right now, no issues, but these guys are under some pressure to IMPROVE the code to be competitive, bad code is bad code and memory messing is like pooping in your pants, they really need to spend some time to fix this or more games, bigger games are going to get clobbered in the store.

    Hope that helps, the sound thing.
    Mike
Sign In or Register to comment.