Jump to content
h4wek

Memory leak on spawn/despawn objects

Recommended Posts

I need to calculate cargo area for specified objects, so I make simple script for get real true info about that, but if you put this to console and wait few minutes (console run continuus this comand in loop and repeating this procedure many times by spawn/despawn all those objects) - the game is stack freezeeng or crash after close console - to repeat effect just put this to function file on empty VR map and you see effect.

 

//["B_Truck_01_cargo_F","Land_metalBarrel_F"] call boxcount  - command to put in console

 

boxcount = {

params ["_transportertype","_cargotype"]; private _boxcount = 0; private _cargos = []; private _full = false;

if (isClass (configfile >> "CfgVehicles" >> _transportertype >> "VehicleTransport" >> "Carrier")) then {
    _transporter = _transportertype createvehiclelocal [0,0,-1000];
    _cargo = _cargotype createvehiclelocal [0,0,-1100];

    while {!_full} do {
        if ((_transporter canVehicleCargo _cargo)#0) then {
            _transporter setVehicleCargo _cargo;
            _cargo = _cargotype createvehiclelocal [0,0,-1100];
            }else {_full = true};
    };

    _cargos = (getVehicleCargo _transporter);
    _boxcount = count _cargos;

    {deletevehicle _x}foreach _cargos;
    deletevehicle _transporter;
    deletevehicle _cargo;
};

_boxcount

};

 

after that nothing get game back to normal even FLUSH or SUPERFLUSH, only restart of mission clen memory area. Is any solution for that in engine? (this cause after longer perioid of time stack of dedicated server if game running very long on the same mission even optimalised scripts not help beacouse of this effect - it looks like every spawned object make space in memory and not relase it after delete completly - BI guys W..T...F? 

  • Like 1

Share this post


Link to post
Share on other sites
boxcount = 
{
    params ["_transportertype", "_cargotype"]; 

    private _boxcount = 0; 
    private _cargos = []; 
    private _full = false;

    if (isClass (configfile >> "CfgVehicles" >> _transportertype >> "VehicleTransport" >> "Carrier")) then 
    {
        _transporter = _transportertype createvehiclelocal [0, 0, -1000];
        _cargo = _cargotype createvehiclelocal [0, 0, -1100];

        while {!_full} do 
        {
            if ((_transporter canVehicleCargo _cargo)#0) then 
            {
                _success = _transporter setVehicleCargo _cargo;
                _cargo = _cargotype createvehiclelocal [0, 0, -1100];
            }
            else 
            {
            _full = true
            };
        };

        _cargos = (getVehicleCargo _transporter);
        _boxcount = count _cargos;

        {deletevehicle _x} foreach _cargos;
        deletevehicle _transporter;
        deletevehicle _cargo;
    };
    _boxcount
};

0 spawn
{
    startLoadingScreen ["Test"];
    for "_i" from 0 to 10000 do
    {
        private _result = ["B_Truck_01_cargo_F", "Land_metalBarrel_F"] call boxcount;
        //diag_log format ["%1: %2: %3", diag_tickTime, _result, _i];
        progressLoadingScreen (_i / 1000);
    };
    endLoadingScreen;
};

 

Cannot reproduce the performance degradation. Even after 50000 runs.

Share this post


Link to post
Share on other sites

Did you try to paste 

["B_Truck_01_cargo_F", "Land_metalBarrel_F"] call boxcount

in console view? and left console open (with paused game) for 5minutes? During this this time function will repeat to calculate result many more times than 50000;

like this:

?imw=5000&imh=5000&ima=fit&impolicy=Lett

Best to do this and watch effects open arma in window and (alt+ctr+del) task manager for look on system resourcesm graph of memory rise and rise up during opened console and paused game I get even 24GB of used memory on this (1 AI on empty VR map with 1 transport vehicle and barrels  in loop of create/delete)  - but bad effect starts even after few GB of rise up.

Share this post


Link to post
Share on other sites

I have proof of this issue on dedicated server during few hours of work when start to use C-Ram guns by AI,on every burst it spawn even 100 of drone_explosive detonations and those objects are deleted after that, dedicated have 50 FPS but scripts are so lagged that for ansver on action takes few seconds, so it is only question of growing empty reserved space after deleted objects in memory, and after this time all go to lagging like after this described method -> many spawned objects = memory overloaded by those spawned objects (even they are deleted already) -> lag is unstopable without restart of mission in this case.

So don't talk bull shits that everything is ok beacouse is not from probably begining of A3. Everyone can do this experiment and have prooof of bugged code of A3 on very deep level - just say  (nobody from those who can repair or understand this part of code not work in BI anymore instead - Cannot reproduce the performance degradation. Even after 50000 runs. )

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×