R mapping (C stack usage 7971616 is too close to the limit)

Dear all,

I got the feedback as below when processed plot(world). I have installed and activated sf package under Rstudio.

Could someone help. Thanks!

C stack usage 7971616 is too close to the limit

There is not that much that can be done about C stack usage from within R; you can monitor it via Cstack_info() but that is about it.

I suspect that there is something wrong about the object you are plotting - what class is it, and what was its origin? It does not come from {sf}.

In order to reduce the load on your session you may consider one of two things:

  • print(st_geometry(world)) = just the boundaries (without data)
  • print(world, max.plot = 1) = just the first data item from world dataframe (whatever that is)

This is always a curveball because the problem is hidden away in the recesses of the operating system that we generally don't visit.

Whether your machine has 4 GB of memory or is attached to 512GB of virtual memory through a shared pool (this actually came up yesterday), there is a tunable per user parameter set on how much is available at any one time.

One tell is that 2^{5.8914} \approx 2^{16}. But no one I know goes around thinking in base2 all the time.

But all modern OSs that I know do.

It turns out that in the unices (can't say about windows) there is a command to manage this

 $ 578:  ulimit

See man ulimit for guidance on how to adjust yours.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Hi jlacko,
Thanks for the response. I just gave it a try on print(st_geometry(world)) and got the result as below:

Geometry set for 177 features
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: -180 ymin: -90 xmax: 180 ymax: 83.64513
Error: C stack usage 7971072 is too close to the limit

By the way, I did check Cstack_info() and got:

size current direction eval_depth
7969177 31216 1 8

stupid, stupid me! it should have been plot, not print
my apologies

strange... and where did you get the world object from?

My favorite world map is via

data("World") # note the capital W!

and it is pretty bulletproof

1 Like

No worries. I did try that too and got:

Error: C stack usage 7970944 is too close to the limit