Hi.
Short description of what happens. The code will create around 173.000
special effects next to each other on the map before removing them.
What I have observed is that war3.exe use around 150MB ram when the map is started.
After the effects are created, it use around 850MB. After the 'cleanup', 722MB...
I have read through many pages and looked for answers, but didn't find anything I didn't know already.
Perhaps I just missed something :S
The effects will be replaced with other types during the game many times,
so a solution for cleaning up 100% after one ore more effects is very needed.
The code that removes the effects is just there to let me know how much it leaks.
Description of the first 3 functions and what values the global variables start with is below the code.
'BrkCounter' is a function that adds a pause every now and then in the loops. Without it, they would never finish.
'SqXtoX' and 'SqYtoY' are just functions that makes locating specific squares easier (I treat the map as a grid of 128x128 point squares).
Start values for the global variables.
Short description of what happens. The code will create around 173.000
special effects next to each other on the map before removing them.
What I have observed is that war3.exe use around 150MB ram when the map is started.
After the effects are created, it use around 850MB. After the 'cleanup', 722MB...
I have read through many pages and looked for answers, but didn't find anything I didn't know already.
Perhaps I just missed something :S
The effects will be replaced with other types during the game many times,
so a solution for cleaning up 100% after one ore more effects is very needed.
The code that removes the effects is just there to let me know how much it leaks.
Description of the first 3 functions and what values the global variables start with is below the code.
JASS:
function BrkCounter takes integer n returns nothing
set udg_brkCounter = udg_brkCounter + 1
if ( udg_brkCounter >= n ) then
set udg_brkCounter = 0
call TriggerSleepAction(0.01)
call DisplayTextToForce( bj_FORCE_PLAYER[0], "." )
endif
endfunction
function SqXtoX takes integer sqX returns real
return I2R(-30016 + 128*sqX)
endfunction
function SqYtoY takes integer sqY returns real
return I2R(-30272 + 128*sqY)
endfunction
function Trig_Dungeon_Generation_Actions takes nothing returns nothing
local integer i = 0
local integer j = 0
local integer k = 0
local integer sqX = 0
local integer sqY = 0
local effect sfx = null
local location loc = null
set i = 0
loop
exitwhen( i > 4 )
set sqX = udg_dngSqXmin[i]
loop
exitwhen( sqX > udg_dngSqXmax[i] )
set sqY = udg_dngSqYmin[i]
loop
exitwhen( sqY > udg_dngSqYmax[i] )
call BrkCounter( 900 )
set loc = Location(SqXtoX(sqX), SqYtoY(sqY))
set sfx = AddSpecialEffectLocBJ( loc, "Doodads\\LordaeronSummer\\Terrain\\LoardaeronRockChunks\\LoardaeronRockChunks2.mdl" )
call RemoveLocation( loc )
set loc = null // *** No noticeable reduction of leaks. ***
set j = R2I( udg_dngSqPlatforms / 8192 )
set k = ModuloInteger( udg_dngSqPlatforms, 8192 )
if ( j == 0 ) then
set udg_dngSqPlatform_00[k] = sfx
elseif ( j == 1 ) then
set udg_dngSqPlatform_01[k] = sfx
elseif ( j == 2 ) then
set udg_dngSqPlatform_02[k] = sfx
elseif ( j == 3 ) then
set udg_dngSqPlatform_03[k] = sfx
elseif ( j == 4 ) then
set udg_dngSqPlatform_04[k] = sfx
elseif ( j == 5 ) then
set udg_dngSqPlatform_05[k] = sfx
elseif ( j == 6 ) then
set udg_dngSqPlatform_06[k] = sfx
elseif ( j == 7 ) then
set udg_dngSqPlatform_07[k] = sfx
elseif ( j == 8 ) then
set udg_dngSqPlatform_08[k] = sfx
elseif ( j == 9 ) then
set udg_dngSqPlatform_09[k] = sfx
elseif ( j == 10 ) then
set udg_dngSqPlatform_10[k] = sfx
elseif ( j == 11 ) then
set udg_dngSqPlatform_11[k] = sfx
elseif ( j == 12 ) then
set udg_dngSqPlatform_12[k] = sfx
elseif ( j == 13 ) then
set udg_dngSqPlatform_13[k] = sfx
elseif ( j == 14 ) then
set udg_dngSqPlatform_14[k] = sfx
elseif ( j == 15 ) then
set udg_dngSqPlatform_15[k] = sfx
elseif ( j == 16 ) then
set udg_dngSqPlatform_16[k] = sfx
elseif ( j == 17 ) then
set udg_dngSqPlatform_17[k] = sfx
elseif ( j == 18 ) then
set udg_dngSqPlatform_18[k] = sfx
elseif ( j == 19 ) then
set udg_dngSqPlatform_19[k] = sfx
elseif ( j == 20 ) then
set udg_dngSqPlatform_20[k] = sfx
elseif ( j == 21 ) then
set udg_dngSqPlatform_21[k] = sfx
endif
set sfx = null // *** No noticeable reduction of leaks. ***
set udg_dngSqPlatforms = udg_dngSqPlatforms + 1
set sqY = sqY + 1
endloop
set sqX = sqX + 1
endloop
set i = i + 1
endloop
call DisplayTextToForce( GetPlayersAll(), I2S(udg_dngSqPlatforms)+" effects created." )
call TriggerSleepAction( 2 )
loop
call BrkCounter( 1000 )
set udg_dngSqPlatforms = udg_dngSqPlatforms - 1
set j = R2I( udg_dngSqPlatforms / 8192 )
set k = ModuloInteger( udg_dngSqPlatforms, 8192 )
if ( j == 0 ) then
set sfx = udg_dngSqPlatform_00[k]
elseif ( j == 1 ) then
set sfx = udg_dngSqPlatform_01[k]
elseif ( j == 2 ) then
set sfx = udg_dngSqPlatform_02[k]
elseif ( j == 3 ) then
set sfx = udg_dngSqPlatform_03[k]
elseif ( j == 4 ) then
set sfx = udg_dngSqPlatform_04[k]
elseif ( j == 5 ) then
set sfx = udg_dngSqPlatform_05[k]
elseif ( j == 6 ) then
set sfx = udg_dngSqPlatform_06[k]
elseif ( j == 7 ) then
set sfx = udg_dngSqPlatform_07[k]
elseif ( j == 8 ) then
set sfx = udg_dngSqPlatform_08[k]
elseif ( j == 9 ) then
set sfx = udg_dngSqPlatform_09[k]
elseif ( j == 10 ) then
set sfx = udg_dngSqPlatform_10[k]
elseif ( j == 11 ) then
set sfx = udg_dngSqPlatform_11[k]
elseif ( j == 12 ) then
set sfx = udg_dngSqPlatform_12[k]
elseif ( j == 13 ) then
set sfx = udg_dngSqPlatform_13[k]
elseif ( j == 14 ) then
set sfx = udg_dngSqPlatform_14[k]
elseif ( j == 15 ) then
set sfx = udg_dngSqPlatform_15[k]
elseif ( j == 16 ) then
set sfx = udg_dngSqPlatform_16[k]
elseif ( j == 17 ) then
set sfx = udg_dngSqPlatform_17[k]
elseif ( j == 18 ) then
set sfx = udg_dngSqPlatform_18[k]
elseif ( j == 19 ) then
set sfx = udg_dngSqPlatform_19[k]
elseif ( j == 20 ) then
set sfx = udg_dngSqPlatform_20[k]
elseif ( j == 21 ) then
set sfx = udg_dngSqPlatform_21[k]
endif
call DestroyEffectBJ( sfx )
set sfx = null // *** No noticeable reduction of leaks. ***
exitwhen( udg_dngSqPlatforms == 0 )
endloop
call DisplayTextToForce( GetPlayersAll(), "Clean up complete." )
call DestroyTrigger( GetTriggeringTrigger() ) // *** No noticeable reduction of leaks. ***
endfunction
//===========================================================================
function InitTrig_Dungeon_Generation takes nothing returns nothing
set gg_trg_Dungeon_Generation = CreateTrigger( )
call TriggerAddAction( gg_trg_Dungeon_Generation, function Trig_Dungeon_Generation_Actions )
endfunction
'BrkCounter' is a function that adds a pause every now and then in the loops. Without it, they would never finish.
'SqXtoX' and 'SqYtoY' are just functions that makes locating specific squares easier (I treat the map as a grid of 128x128 point squares).
Start values for the global variables.
Code:
set udg_dngSqXmin[0] = 1
set udg_dngSqXmax[0] = 80
set udg_dngSqYmin[0] = 388
set udg_dngSqYmax[0] = 468
set udg_dngSqXmin[1] = 1
set udg_dngSqXmax[1] = 228
set udg_dngSqYmin[1] = 193
set udg_dngSqYmax[1] = 377
set udg_dngSqXmin[2] = 244
set udg_dngSqXmax[2] = 468
set udg_dngSqYmin[2] = 193
set udg_dngSqYmax[2] = 377
set udg_dngSqXmin[3] = 1
set udg_dngSqXmax[3] = 228
set udg_dngSqYmin[3] = 1
set udg_dngSqYmax[3] = 184
set udg_dngSqXmin[4] = 244
set udg_dngSqXmax[4] = 468
set udg_dngSqYmin[4] = 1
set udg_dngSqYmax[4] = 184
Last edited by a moderator: