Replication: Snapshot agent execution causes system Available Memory to drop to 0 and possibly fail

Problem:

While running the snapshot agent, the available memory of the server goes down to 0 and snapshot may even fail. Should the snapshot complete, the memory is released very slowly.

Cause:

This is because in the current design (SQL 2005 and higher), snapshot agent uses SNAC BCP provider which uses memory mapped files for BCP out data and does not flush the data based on a threshold.

Solution:

https://support.microsoft.com/kb/2582285