🐛 Release large scale operation state on failure
The bitmask arrays, operations, and pending radar packets were only released at the end of the straight-line handler, so any exception leaked tens of megabytes per malformed request.
This commit is contained in:
@@ -962,6 +962,7 @@ begin
|
||||
CEDServerInstance.SendPacket(nil, TServerStatePacket.Create(ssOther,
|
||||
Format('%s is performing large scale operations ...', [ANetState.Account.Name])));
|
||||
|
||||
try
|
||||
//Bitmask
|
||||
emptyBits := TBits.Create(64);
|
||||
SetLength(bitMask, FWidth * FHeight);
|
||||
@@ -1146,17 +1147,20 @@ begin
|
||||
end;
|
||||
|
||||
//clean up
|
||||
finally
|
||||
for i := Low(bitMask) to High(bitMask) do
|
||||
bitMask[i].Free;
|
||||
bitMask[i].Free;
|
||||
emptyBits.Free;
|
||||
additionalAffectedBlocks.Free;
|
||||
|
||||
|
||||
for i := 0 to operations.Count - 1 do
|
||||
TLargeScaleOperation(operations.Items[i]).Free;
|
||||
TLargeScaleOperation(operations.Items[i]).Free;
|
||||
operations.Free;
|
||||
|
||||
//Update clients
|
||||
|
||||
FRadarMap.EndUpdate;
|
||||
end;
|
||||
|
||||
//Update clients
|
||||
for i := Low(clients) to High(clients) do
|
||||
begin
|
||||
if Length(clients[i].Blocks) > 0 then
|
||||
|
||||
Reference in New Issue
Block a user