[R] Rprof causing R to crash
jim holtman
jholtman at gmail.com
Mon Feb 4 18:03:32 CET 2013
Could you be a little more explicit of what the error message is. On
my Windows system 32-bit, I get the following:
> 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?
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)
On Mon, Feb 4, 2013 at 7:48 AM, c97sr <sr at stevenriley.net> 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 at r-project.org 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.
More information about the R-help
mailing list