Hi there,

Thanks for the quick feedback.

There is no further info on the reason for the crash - R just stops.

The for loop is there just to generate the error. I'm following a previous
example that others couldn't reproduce. I need Rprof to work on a different
set of functions that I haven't posted. Those function do involve some
"large" arrays, but have never given any trouble away from Rprof.

I'm pretty sure Rprof is broken. Is there an alternative?

Cheers

Steven

Sent from phone.
On Feb 4, 2013 5:03 PM, "jim holtman" <jholtman@gmail.com> wrote:

> 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@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@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.
>

	[[alternative HTML version deleted]]

