Help! Erlang heap error crash everyday

I’m running Couchbase 4.5 on a Windows 2012 VPS with 6 gb of ram and 8 cores.

Everyday after about a day of activity the server crashes and the only way to make it work
again is to restart Windows.
The same used to happen with Couchbase 4.1.

I was working with another VPS before and didn’t have this error. Now it’s quite annoying as my application has
few bugs left but the database crashes, and I’m not qualified to debug it.

For info, I use N1QL queries with indexes.

Any help would be much appreciated.

Below are excerpts of logs. I can send more detailed logs if somebody tells me where to send them.
The first lines mentioning the crash in babysitter.log are

ns_server<0.71.0>: Crash dump was written to: erl_crash.dump
ns_server<0.71.0>: eheap_alloc: Cannot allocate 13818888 bytes of memory (of type “heap”).

The first lines of the erl_crash.dump are

Mon Feb 29 08:29:25 2016
Slogan: eheap_alloc: Cannot allocate 9596456 bytes of memory (of type “old_heap”).
System version: Erlang R16B03-1 (erts-5.10.4) [64-bit] [smp:8:8] [async-threads:16]
Compiled: Thu Jan 23 17:47:51 2014
Taints: ejson,crypto
Atoms: 19396
total: 706799328
processes: 281290712
processes_used: 281269072
system: 425508616
atom: 586345
atom_used: 565027
binary: 149266240
code: 14086652
ets: 256947568

Hi @faysou,

At a guess (without seeing the full logs) I would suspect your system does not have enough RAM. Try increasing the amount of RAM in the VPS or add more paging space to the system and see if that solves your problem.

@pvarley this could be it indeed, my virtual memory was set to 2048 mb max, which seems low.

I’ve increased it and will report here if this solves the problem or not within a few days (this is the scale of the problem).

It seems to work and this makes sense as the error was a heap error. Thank you very much @pvarley.