Search the Community
Showing results for tags 'garbage'.
-
I'm noticing from the profiler that when I run the particle emitter in my game, the heap builds up over the course of a couple seconds and then drops back down after the garbage collection. To be sure the test is accurate, I've turned off everything else in my game so it is *only* the particle emitter that is running. My understanding is that once the initial pool of particles are created (in my case, 200), no more objects should be dynamically allocated, so why is this happening? My emitter uses a custom particle class that calls the kill() method on the particle when the particle gets more than a certain distance away from the source. My impression is that by calling kill rather than destroy, Phaser should be able to use the same particles over and over again. Why is Phaser, apparently, not reusing the particles? I'm using Phaser 2.6.2.
-
hi everyone, im wondering if when i end a level i should call a method to destroy and collect garbage variables to free memory and resources in a game. do you often do that? and how do you do it? thanks
-
Hey all, I'm making a single page app that uses a Pixi CanvasRenderer on one of the screens. When I clean up my views in JS, I am getting zombie objects because there's no way to unbind the events on the Pixi renderer/stage. Take a look at this heap snapshot... How can I free up these objects for collection? Thanks a lot!
-
I am having big issues with Phaser in regards to garbage collection (GC). See for yourself. DEMO http://knostara.de/prototypes/gc/ JSFIDDLE http://jsfiddle.net/dWws9/ ISSUE Currently i am adding 30x30 (900) sprites in order to simulate a isometric tile map. This causes an immense increase in the GC activity. We are talking about a GC cycle roughly every 400 ms. By decreasing the tile number and therefore the sprite number the GC activity drops proportionately. QUESTIONS 1. Is this a known issue? 2. Is this how it is supposed to work? If yes, can someone explain why? 3. Is my approach flawed? 4. Is this a problem with pixi.js? (I didn't experience such trouble with the pixi.js demos) 5. Are there any solutions to this problem? Other approaches? Thanks for your time! CODE GAME = new Phaser.Game(1280, 720, Phaser.CANVAS, 'gameWindow', { preload: preload, create: create});function preload() { GAME.load.image('grass_tile', 'assets/gt_7.png');}var randomInt;var posY;var x;var y;var TILE_SIZE_WIDTH = 64;var TILE_SIZE_HEIGHT = 32;var TILE_OFFSET_MODULO = -TILE_SIZE_WIDTH / 2;var TILE_MAP_WIDTH_TILES_COUNT = 30;var TILE_MAP_HEIGHT_TILES_COUNT = 30;var TILE_MAP_OFFSET_Y = 200;var group;function create() { group = GAME.add.group(); for (y = 0; y < TILE_MAP_HEIGHT_TILES_COUNT; y++) { for (x = 0; x < TILE_MAP_WIDTH_TILES_COUNT; x++) { // Create some random noise, so the ground doesn't look leveled randomInt = ((Math.random() * 4) + 0) | 0; if (randomInt % 2) { randomInt = -randomInt; } posY = TILE_MAP_OFFSET_Y + (y * TILE_SIZE_HEIGHT / 2) + randomInt | 0; if (y % 2 === 0) { group.create((x * TILE_SIZE_WIDTH), posY, 'grass_tile'); } else { group.create(TILE_OFFSET_MODULO + (x * TILE_SIZE_WIDTH), posY, 'grass_tile'); } } }}