GridGraph Update freeze

Hello,

I’m having some issues updating my GridGraph. Every time I place a building on my terrain, it should update the GridGraph so the AI avoids them. My Problem is that the game freezes for about 0.5 Seconds when I place a building (when it calls AstarPath.active.UpdateGraphs(newBuilding.collider.bounds); ).
My terrain is 500 by 500 big and the GridGraph as well.
Could the size be one problem? If so how would I make it so it still works with this size?
Is the approach of updating the Gridgraph everytime I place a building wrong?

Thanks in advance!