Fangames > Programming Questions
Out of Memory Error
Tamatou:
Hello guys.
So I've been working on my fangame for a while now, currently I am working on the first Boss. But suddenly Game Maker startet getting "Out of Memory" Error Messagen about 40% of the Time when starting the game and about 10% of the time when saving it.
This is very annoying. Has anyone had this same problem? I've heard it's relativly common. But is there a way to fix it?
klazen108:
You mention that this only happens like 40% of the time, so it leads me to believe that your game has a memory leak. This is usually caused by acquiring handles for data structures, particle systems, maybe externally loaded sprites/backgrounds/music, etc. and then not freeing them when you're done. Does your game use any ds functions? (like ds_list_*, ds_map_*, etc). What about particle functions? (like part_system_create()) Or how about external loading? (background_add, sprite_add)? When you open a file for reading/writing, for instance during saving, do you close the handle afterwards? (file_bin_close or file_text_close)
If you can think of any of these things that might be in your game, it'll help pinpoint what might be wrong!
Tamatou:
The only thing I have is one particle system used to create smoke (ALOT of smoke)
I've heard externally loading music can reduce the loading time, but I haven't really looked into that so far.
My loading time is getting longer and longer the more I work on the game (I suppose that is to be expected) But my game isn't really that big. It just has alot of (unecessary) effects like Screen Shake, Light and Darkness Effects, Zoom Effect etc...
Oh, and I never really heard of DS_Functions until now.
klazen108:
You mention you're using a particle system. When do you create and destroy your particle system? And which fangame engine are you using? If you're using an engine like yuuutu, and creating your particle system on game start, but not destroying it on game end, then you're actually creating a new particle system every time you press R! Try just opening your game, saving, and just pressing R over and over and see if you can get it to crash really fast - if so you've got a memory leak on your hands.
Also, how big is your project file (the gmk or gm81 file)? Just so I can imagine how much stuff is actually in your game, to see if that's becoming an issue. The effects wouldn't matter much, but large, animated sprites and backgrounds can really eat at your memory consumption without you noticing. Images are stored compressed in PNG format but are uncompressed when loaded into memory, dramatically increasing the amount of space they take up. As a quick example, a plain 800x600 black rectangle is just 4kb big as a PNG, but it's 1MB as a sprite! Music is another big one, especially if you store your music as WAV files (don't do that!).
Tamatou:
I am using the YoSniper I Wanna Be The Engine (not the newest version though)
Oh no, I've always been using WAV for Music. There are only like 6 songs in the Game so far.
I tried pressing R alot but that doesen't seem to affect the game. Also there visualy doesn't appear to be more smoke particles.
Note that the game never crashed when running. It only crashes when game maker is loading it up and rarely (and annonyingly) when saving the file.
The Game Maker File is 208 MB
So I am indeed worried that the game might get too big eventually. Game is only about 5% done.
Slightly Off Topic:
Now that is wierd. I originally wanted the boss to choose one of two attacks to start out on. But sometimes a glitch would occour where the boss spawned twice the amount of bullets making avoiding nearly impossible. I've worked around this by giving the boss a third attack that he would do whenever this glitch occured. But now suddely the glitch doesn't occur anymore so now he never uses his third attack. Don't worry I can easily fix this. But it just really astonished me.
Navigation
[0] Message Index
[#] Next page
Go to full version