In order to avoid out of memory error, you should make sure the values for the paramaters NumberOfBuffers? and MaxCheckpointRemap? are not set with the same values.
For example, the following configuration will cause an error out of memory:
# virtuoso.ini ... [Parameters] NumberOfBuffers = 246837 MaxDirtyBuffers = 18517 MaxCheckpointRemap = 246837 ...
Changing the value of the parameter MaxCheckpointRemap? with let's say 1/4 of the DB size will resolve the issue.