Ruby selenium. unknown error: session deleted because of page crash. Invalid Session id

I start a new build in circle ci (Ruby/Capybara/Selenium/Chromedriver) and it fails after ~40 minutes. First error is:

        **unknown error: session deleted because of page crash**
**          from unknown error: cannot determine loading status**
**          from tab crashed**
            (Session info: chrome=78.0.3904.70) (Selenium::WebDriver::Error::UnknownError)
          #0 0x564c6506e7e9 <unknown>

And then Selenum raises errors like

        **invalid session id (Selenium::WebDriver::Error::InvalidSessionIdError)**
**          #0 0x564c6506e7e9 <unknown>**

This behaviour concernes only one specific project, so on the second one everything is okay. The difference between them is that I have more 100 test on project that fails in comparison with second where is only 95, however error raises on ~40th test.
In addition, I tried to find lack of memory using

            while :
         do
             echo "*** start of memory logging ***"
             free -h >> /gen/memory.log
             free -h
             ps -o pid,user,%mem,command ax
             echo "*** end of memory logging ***"
             sleep 10
         done

This didn’t help because it shows

                                total        used        free      shared  buff/cache   available
         Mem:           68Gi        12Gi       1.8Gi       163Mi        54Gi        55Gi
         Swap:            0B          0B          0B

So looks like everything is okay with memory right when page is about to crash

It is tough to inspect memory because commands like free will look at the underlying host, not the docker container that the build is running in.

By default you get a total of 4GB of RAM to share with all processes and containers within a build. If you are running out of memory you may have a leak, or it is possible that chrome is not being closed properly as a part of your test suite.

You may be able to get some more insights if you debug by VNCing into the box while the test are running to see what is going on with chrome.