[R] Rprof causing R to crash

c97sr sr at stevenriley.net
Mon Feb 4 21:26:43 CET 2013


Hi Jim,

> Could you be a little more explicit of what the error message is.  On
> my Windows system 32-bit, I get the following:

Sorry - it just "stops" as per the message posted. The text is from eclipse.

>  Rprof()
>  z <- 1
>  system.time(for (i in 1:1e8) z <- z + 1/i)
>  Error: cannot allocate vector of size 381.5 Mb

> Which is probably due to trying to allocate 1e8 elements of integers
> (400MB).  Could you have a similar problem?

Shouldn't be. 400MB shouldn't be a problem on a 4GB machine? 

Just tried this with no problem on 2.15.0 on "Platform:
x86_64-redhat-linux-gnu (64-bit)", so it looks to be particular to my setup
on the mac. I also just tried 2.15.2 on the mac using the GUI and  _not_
eclipse, It worked with no problem.

Therefore, it seems that my issues are specific to R 2.15.2 (and R 2.14.0
prior to upgrade) running via StatEt's rj package (with no additional
arguments.) I have a workaround now, and I guess this is no longer an issue
for the wider group. Will post a link to the StatEt group.

cheers

Steven


Now you could restructure your code to not allocate the large vector by:

Rprof()
z <- 1
i <- 0
system.time(while((i <- i + 1) < 1e8) z <- z + 1/i)
z
Rprof(NULL)

Yes - the example is not related to my code, its just a way of recreating a
similar error. I haven't posted my code that causes the error.

Is there a reason that 400 MB should be a problem for RProf? My previous
experience is that Rprof is stable with processes with much larger memory
footprints. Hence why I think the for loop error might be related to the
problems I'm having.

Is there an alternative to Rprof? This is fairly crucial for me right now.
Will try to get setup on 

cheers

Steven




On Mon, Feb 4, 2013 at 7:48 AM, c97sr <sr@> wrote:
> Am also having trouble with Rprof.
>
> I am using on R 2.15.2 on the Mac (Platform:
> x86_64-apple-darwin9.8.0/x86_64
> (64-bit)).
>
> The example above without profiling takes around a minute to run:
>
>> z = 1
>> for (i in 1:1e8) z = z+1/i
>> z
> [1] 19.9979
>
> With profiling:
>
>> Rprof()
>> z = 1
>> for (i in 1:1e8) z = z+1/i
>
> [INFO] Feb 4, 2013 12:45:20 PM - R stopped.
>
> Crashes within a second or so.
>
> This is consistent with the problem I'm having in my own code in which
> there
> is a reasonable amount of memory used (but not a massive amount).
>
> Any help much appreciated. Am happy to post this as a bug if that is now
> appropriate.
>
> regards
>
> Steven
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Rprof-causing-R-to-crash-tp4652846p4657482.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@ mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

______________________________________________
R-help@ mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





--
View this message in context: http://r.789695.n4.nabble.com/Rprof-causing-R-to-crash-tp4652846p4657545.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list