Try monitoring your memory usage while playing.
Specifically, you want to use the Task Manager.
Open Task Manager, then click on Performance, then on Memory.
Under here toward the bottom under the graphs, there should be a section labeled “Committed”.
While playing, watch this part closely. If you see the committed in use amount get near the available amount (as an example, 30.3/31.8 GB), then you need to make adjustments to the swap file.
You can follow steps here, but use a setting of 32768 for your setup:
-Diablo IV has run out of memory - #103 by DTMAce-1687
Keep in mind, this has been helping some players, but its not a fix for everything. But if you notice your virtual memory (Committed) being filled up near the limit, you may want to make this adjustment to alleviate the problem. It will not hurt your system, other than require potentially more drive space on your C: drive. And be sure to only use one drive, do not put it on other drives or use a drive other than your OS C: drive.
As an example, when gaming D4, mine has been showing numbers of 36-38/63.8 GB