🐛 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,
|
CEDServerInstance.SendPacket(nil, TServerStatePacket.Create(ssOther,
|
||||||
Format('%s is performing large scale operations ...', [ANetState.Account.Name])));
|
Format('%s is performing large scale operations ...', [ANetState.Account.Name])));
|
||||||
|
|
||||||
|
try
|
||||||
//Bitmask
|
//Bitmask
|
||||||
emptyBits := TBits.Create(64);
|
emptyBits := TBits.Create(64);
|
||||||
SetLength(bitMask, FWidth * FHeight);
|
SetLength(bitMask, FWidth * FHeight);
|
||||||
@@ -1146,17 +1147,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
//clean up
|
//clean up
|
||||||
|
finally
|
||||||
for i := Low(bitMask) to High(bitMask) do
|
for i := Low(bitMask) to High(bitMask) do
|
||||||
bitMask[i].Free;
|
bitMask[i].Free;
|
||||||
emptyBits.Free;
|
emptyBits.Free;
|
||||||
additionalAffectedBlocks.Free;
|
additionalAffectedBlocks.Free;
|
||||||
|
|
||||||
for i := 0 to operations.Count - 1 do
|
for i := 0 to operations.Count - 1 do
|
||||||
TLargeScaleOperation(operations.Items[i]).Free;
|
TLargeScaleOperation(operations.Items[i]).Free;
|
||||||
operations.Free;
|
operations.Free;
|
||||||
|
|
||||||
//Update clients
|
|
||||||
FRadarMap.EndUpdate;
|
FRadarMap.EndUpdate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//Update clients
|
||||||
for i := Low(clients) to High(clients) do
|
for i := Low(clients) to High(clients) do
|
||||||
begin
|
begin
|
||||||
if Length(clients[i].Blocks) > 0 then
|
if Length(clients[i].Blocks) > 0 then
|
||||||
|
|||||||
Reference in New Issue
Block a user