Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411508 Posts in 69374 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 10:37:35 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Game Maker Particle System Memory Leak.
Pages: [1]
Print
Author Topic: Game Maker Particle System Memory Leak.  (Read 1851 times)
jboxx
Level 1
*


View Profile
« on: March 30, 2015, 07:16:07 AM »

Been sort of struggling with this as of late.  I have this really neat particle effect for when my character has a spell active which will stay on the character for the entirety of the game, but it's causing a memory leak and after only a minute of playing, the game slows down a ton, it starts off at 60fps, but gradually gets slower until it's at about 15fps, even when I'm not shooting any of the projectiles which also give off particles


I've been reading up on this and all I'm seeing is that you need to destroy the particle system when it's not in use, but what about an effect that will stay on the entirety of the game?  I've been looking all over the place for a solution and posting here really is my last resort, as I don't like to bother forums with questions that may be very simple and mundane.  Here is my code


There is nothing in the create event, it's all in the step event.  My first solution was that maybe if I destroy the particle system every few seconds and let it come back, it will be ok, but I have no idea where to put the particle destroy function.  Any help is GREATLY appreciated, and if having particles like this is simply not possible to have a particle effect like this on the entire game, I'd appreciate that too.   Sorry for the absolutely atrocious code, I really don't know what I'm doing when it comes to programming.
Logged
mokesmoe
Level 10
*****



View Profile WWW
« Reply #1 on: March 30, 2015, 10:34:02 PM »

You seem to be creating a new particle system, emitter and type every time you want to create particles and not removing them anywhere. This means after 10 seconds you will have 600 separate particle systems all active at the same time (assuming only one of those is running), which is very clearly a problem.

You should use the create event to create your particle system and then just use that one system for all of your particles. You should probably also use just one emitter in the same way, and create the 4 particle types and set their properties there too.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic