This occurs when running a very large Word merge in particular. It appears intermittent, as the same Merge can be successfully run at a later date.
Here are a few ways to handle this issue:
Split the merge across a series of jobs that process sequentially
Add additional memory to the server(s)
Merge the content external to CRM in Microsoft Word
Because of the large number of variables that exist in Merge document complexity, list size, and server specifications; there is no one answer that fits all scenarios. Additionally, there are also limitations on what Microsoft Word can handle in a merge, as indicated in this Microsoft Knowledgebase article: https://support.microsoft.com/en-us/kb/211489