From simon.urbanek at r-project.org  Sat Mar 29 20:35:05 2014
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Sat, 29 Mar 2014 15:35:05 -0400
Subject: [Rd] Error: C stack usage is too close to the limit
In-Reply-To: <80195E5E-FBA4-472A-A161-C0286CC134A0@gmail.com>
References: <CAPSN_LUYkKv42YecOApxQwKZu7mNNBOWP4sgBO=0JHzQDzHS8g@mail.gmail.com>
	<80195E5E-FBA4-472A-A161-C0286CC134A0@gmail.com>
Message-ID: <A2449657-C45A-4845-B723-3CBF992F6A73@r-project.org>


On Mar 29, 2014, at 4:12 AM, Randy Lai <randy.cs.lai at gmail.com> wrote:

> I have similar experience previously. What I done was disabling stack limit checking
> 
>    R_CStackLimit = -1;
> 
> and increasing the stack size to .16*1024*1024.
> 
> Hope it helps.
> 

Well, it will result in R crashing instead :)

So be careful with this approach - you will get crashes that will seem inexplicable. Also note that calling R from different threads is unsafe unless you also make sure that the error handling doesn't cross stacks or thread boundaries. You should rather enqueue R calls to the main thread, unless you are really a guru and know how to avoid such issues across signals and errors.

Cheers,
Simon


> Randy
> 
> On Mar 28, 2014, at 2:55 PM, Florian Burkart <florian.burkart at gmail.com> wrote:
> 
>> Hi,
>> 
>> I have been using my own C++ plugin for a while.
>> 
>> On a new machine I now keep getting the
>> 
>> C stack usage is too close to the limit
>> 
>> error. I played with it and it appears to come after I printed a fixed
>> number of text to R via Rprintf (not from the main thread).
>> 
>> Didn't happen on the old machine. Old version was 2.14. Now on 3.0.3.
>> 
>> Not sure whats going on.
>> 
>> Florian
>> 
>> 	[[alternative HTML version deleted]]
>> 
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 



[Rd] Error: C stack usage is too close to the limit
Simon Urbanek