User Tag List

Results 1 to 6 of 6

Thread: Magical RAM clean after 5 minutes - why?

  1. #1
    Clicker Fusion 2.5 (Steam)Android Export Module (Steam)

    Join Date
    Feb 2014
    Posts
    40
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Magical RAM clean after 5 minutes - why?

    Hi,

    I try to optimize my game (Dungeons of the Fallen on steam greenlight) since after I created a bigger map I've been experiencing RAM issues on runtime. When I get to the main gameplay screen the usage is above 1600MB with around 500 objects. When I disabled backgrounds the RAM starts with 1400 MB which is still a lot for a 2d game.

    Here's the fun part. After 5 minutes even without disabling anything and with 500 objects on frame the RAM usage magically decreases to 80MB. I don't see anything in my code starting with 5 minute mark which would affect it. Is there some internal cleanup of memory every 5 minutes?

    I have a quite lot of arrays loading at the beginning of frame maybe its somehow related to how they work..

    I will appreciate any help!


    EDIT: During another test on different map the cleanup occurred after around 2 and half minutes. On another one after 20 secs. I have no idea what triggers it though.

    EDIT2: It seems not to be map dependent. On the same map the cleanup can occur after 20 seconds, after two or after five. It appears to be random..

  2. #2
    Clicker Fusion 2.5 (Steam)Android Export Module (Steam)

    Join Date
    Feb 2014
    Posts
    40
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Ok, it turned out that what takes so much place are the big backgrounds. However even if I uncheck Create at Start they got loaded into memory which surprised me. Only after deleting them the frame starts with ~200mb RAM instead of ~1400mb.

    So either I can do something about background sizes or somehow trigger this magical memory cleanup.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    piscesdreams's Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    1,027
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Are your art assets following the power of 2 rule?

  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Firstly, people worry far too much about things using a lot of memory - that's what it's for. Unused RAM is wasted RAM, and as long as you don't run out of it altogether, it's not going to be the bottleneck that limits performance - even on their smartphones, who has less than 2GB of RAM these days?

    The reason for the initial high memory usage is that your app will be decompressing the image data, probably doing something with the collision mask, etc. At some point after it has finished doing that, the garbage collection kicks in to free up the memory that it was using (exactly when it will choose to do this is a very complicated matter, and it is both totally unpredictable and totally out of your hands - google "garbage collection" if you want to see what I mean).

    You'll find that "picture" objects use far less memory than "backdrop" objects.

    What big backgrounds are you talking about anyway? Your game appears to be tile-based? (please tell me you're not building a map from tiles and then saving it as a single image)

  5. #5
    Clicker Fusion 2.5 (Steam)Android Export Module (Steam)

    Join Date
    Feb 2014
    Posts
    40
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    @piscesdreams: no, I found out about it yesterday

    @MuddyMole thanks for explaining the theory about the garbage collection it's all clear now.

    The biggest map I've done is 4160/3680. However, I think the issue here is the size of the Active objects with all the maps in the animation frames. I have 3 Active Objects on different layers with different maps based on the imported pngs made in Tiled.

    When the gameplay frame loads, the game checks from the save on which level you currently are and pick a map from animation frames of the objects.
    Two of them are pasted into the background (collision and non-collision) and the third one goes a layer above representing all things which are above the player in a top down environment (roofs, higher parts of trees).

    Until now I didn't have any performance issues with this approach so thought it was fine. What better way do you recommend when developing a top down action rpg like this https://www.youtube.com/watch?v=leoWb9lZY7A? I will keep experimenting. When the game is finished I can always use multiple frames and split the active object with backgrounds so each frame loads only few of them.

    Thanks for all the help.

    EDIT: Just realized I posted in wrong sub-forum. I use Clickteam Fusion 2.5.

  6. #6
    Clicker Fusion 2.5 (Steam)Android Export Module (Steam)

    Join Date
    Feb 2014
    Posts
    40
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    The problem was that I stored all the maps as frames in a one active object. Even though only one frame map is needed when loading a level it seems like all the frames have been loading into memory. I made a separate active object for each map with Load on Call activated to make sure only the one in use is loaded into memory. Works like a charm. New levels load in a second

Similar Threads

  1. Patrice is using Magical Voxel - Cool!
    By Kisguri in forum Firefly
    Replies: 10
    Last Post: 6th January 2017, 06:47 AM
  2. Flabby Bird - A Magical Obese Adventure
    By jasonorme in forum Android Export Module 2.5
    Replies: 2
    Last Post: 4th March 2014, 02:20 AM
  3. Clean INI data
    By paobrasil in forum iOS Export Module Version 2.0
    Replies: 4
    Last Post: 26th September 2012, 11:50 PM
  4. Clean is your friend!!
    By Paul_Boland in forum iOS Export Module Version 2.0
    Replies: 3
    Last Post: 16th December 2011, 08:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •