Silent memory limit exceeding, ScaleData() from Seurat causes crash


Using the sample data in the 2,700 PBMC clustering tutorial, the session crashed at the ScaleData() step. I've tried reducing the size for number of genes to scale at in a single computation with the argument block.size with no change. The Seurat S4 object is only ~70mb so I can't imagine I'm exceeding the RStudio Cloud 1gb RAM limitations.


Free Workspace Limitations?
Is it possible to launch long-running non-interactive jobs on RStudio Cloud?

I've used the R package ulimit (github repo) to get a handle on this problem, which I believed to be a memory issue. The user can set a limit the memory available to R. I've set the limit to 1GB before running anything. The first line actually reading the data in trips the limit, which was surprising to me as I didn't receive any errors before using ulimit. Fast-forward to the call to ScaleData(), the function attempts to allocate a vector of size 138MB, which is halted by ulimit. It seems to be a memory limit after-all. I recommend using this package and setting a limit for all new R projects on RStudio Cloud, as it it doesn't seem to tell the user when they've exceeded the allotted memory. In fact, in my case one situation was completely silent and the other mentioned nothing of exceeding available memory.

Of course everything above depends on trusting the function and reporting of ulimit, which could be complicated both by being within and RStudio session and by being in a docker container.

1 Like