0

I use the latest version of R (4.2.2 Patched)

I was downloading a set of packages for my work when one failed (bayou). I tried to fix the problem via increasing the memory usage of R in the terminal (I use Ubuntu), as I got this error when trying to install the package:

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

To try and deal with this issue, I uninstalled and reinstalled R and RStudio, and restarted my PC.

However, now when I open R, I get this:

R version 4.2.2 Patched (2022-11-10 r83330) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Error: C stack usage  7976516 is too close to the limit
[Workspace loaded from ~/.RData]

With the same error:

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

Showing up in the opening text.

It also does not save the packages I download from closing RStudio to opening it again. It also will not download devtools, with the same error popping up:

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

My environment comes from:

source(renv/activate.r)

Changing this to my .Rproject directory doesn't help.

I know this error usually comes from something recursive in the code like a function calling itself, but honestly, I don't know how this could be happening.

I would be grateful if someone knew how to fix this error!

hemr3
  • 23
  • 5
  • Does this answer your question? [Error: C stack usage is too close to the limit](https://stackoverflow.com/questions/14719349/error-c-stack-usage-is-too-close-to-the-limit) – stdunbar Feb 01 '23 at 18:25
  • @stdunbar, when I tried this ulimit -s # print default 8192 $ R --slave -e 'Cstack_info()["size"]' size 8388608 8388608 = 1024 * 8192; $ ulimit -s 16384 # enlarge stack limit to 16 megs $ R --slave -e 'Cstack_info()["size"]' size 16777216 --- I got the same error of C stack usage is too close to the limit in the terminal! – hemr3 Feb 01 '23 at 18:27
  • 1
    You have an infinite loop/recursion someplace. What do you mean your environment comes from "source(renv/activate.r)"? Do you have `.Rprofile` file set up? It sounds like that file it trying to source itself at some point. It's hard to help without any sort of reproducible example – MrFlick Feb 01 '23 at 18:28
  • @MrFlick - I can't reproduce this unfortunately, as I can't even download the renv package without the error showing up. I don't think I have an .Rprofile set up, and I'm not really sure how to. Where could the recursion be in the opening of RStudio? – hemr3 Feb 01 '23 at 18:31
  • 1
    R will automatically run code located in several place documented in the `?Startup` help page. It also appears you are reloading a previous workspace. Is that your itention? Normally we don't recommend that. But that means you have an `.RData` file in your home directory that's automatically being loaded. I still don't understand where exactly you are calling that `source` command. Increasing memory or adjusting stack size will not help you. You need to figure our where the recursion is coming form. Has R ever worked? What was changed before the issue started? – MrFlick Feb 01 '23 at 18:46
  • @MrFlick Nothing seems to have changed! I was trying to download the package bayou, and R was having trouble with it. I then tried several other ways on RStudio, and then uninstalled and reinstalled R, and then this problem occured. – hemr3 Feb 01 '23 at 19:27

0 Answers0