fix: more aggressive memory management

This commit is contained in:
Kazhnuz 2021-04-03 10:39:34 +02:00
parent a2246f9bc7
commit ee59bc988b
10 changed files with 15 additions and 13 deletions

View file

@ -23,8 +23,8 @@
local Widget = {} local Widget = {}
BaseWidget = Object:extend() local BaseWidget = Object:extend()
TextWidget = BaseWidget:extend() local TextWidget = BaseWidget:extend()
-- INIT FUNCTIONS -- INIT FUNCTIONS
-- Initialize and configure the widget -- Initialize and configure the widget

View file

@ -54,6 +54,7 @@ function SceneManager:setStoredScene(name)
if storedScene ~= nil then if storedScene ~= nil then
self.currentScene = storedScene self.currentScene = storedScene
self.storage[name] = nil self.storage[name] = nil
collectgarbage()
self.currentScene:restored() self.currentScene:restored()
end end
end end
@ -73,6 +74,7 @@ function SceneManager:update(dt)
if (self.nextScene ~= nil) then if (self.nextScene ~= nil) then
self.currentScene = self.nextScene self.currentScene = self.nextScene
self.nextScene = nil self.nextScene = nil
collectgarbage()
end end
if (self.currentScene ~= nil) then if (self.currentScene ~= nil) then

View file

@ -1,6 +1,6 @@
AbstractMobParent = require "game.abstractmobs.parent" local AbstractMobParent = require "game.abstractmobs.parent"
AbstractCharacter = AbstractMobParent:extend() local AbstractCharacter = AbstractMobParent:extend()
local charutils = require "game.utils.characters" local charutils = require "game.utils.characters"

View file

@ -1,6 +1,6 @@
AbstractMobParent = require "game.abstractmobs.parent" local AbstractMobParent = require "game.abstractmobs.parent"
AbstractEnnemy = AbstractMobParent:extend() local AbstractEnnemy = AbstractMobParent:extend()
local ennutils = require "game.utils.ennemies" local ennutils = require "game.utils.ennemies"

View file

@ -1,4 +1,4 @@
EventUtils = {} local EventUtils = {}
-- steps utils -- steps utils

View file

@ -1,4 +1,4 @@
Scene = require("core.modules.scenes") local Scene = require("core.modules.scenes")
local PlayStyle = Scene:extend() local PlayStyle = Scene:extend()
local PauseMenu = require("game.modules.subgames.pause") local PauseMenu = require("game.modules.subgames.pause")

View file

@ -1,4 +1,4 @@
BattleUtils = {} local BattleUtils = {}
local datasutils = require "game.utils.datas" local datasutils = require "game.utils.datas"

View file

@ -1,4 +1,4 @@
ChoregraphyUtils = {} local ChoregraphyUtils = {}
-- steps utils -- steps utils

View file

@ -1,4 +1,4 @@
DataUtils = {} local DataUtils = {}
local DATADIR = "datas" local DATADIR = "datas"
local GAMEDATADIR = "gamedata" local GAMEDATADIR = "gamedata"

View file

@ -21,8 +21,8 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]] ]]
Core = require "core" local Core = require "core"
Game = require "game" local Game = require "game"
scenes = require "scenes" scenes = require "scenes"