System.OutofMemoryException while Deploying Solutions

At times while deploying the Solution package in a FARM environment, the solution gets deployed to some of the WebFrontEnd servers (WFE) and on some of the WFE you get error something which looks like:

WFE ServerName: Exception of type 'System.OutofMemoryException' was thrown.

Out of memory exceptions are generally caused due to the amount of system resources that the Timer service is utilizing. Restarting the timer service on that specific WFE server (that gave the error) might resolve the error.