I used it because it reads the maximum memory limit from globals a few lines up.

Possibly both should be read from the agentTopology, but it is consistent with the existing code.