From hpages at fhcrc.org  Thu Feb  9 02:36:18 2012
From: hpages at fhcrc.org (=?ISO-8859-1?Q?Herv=E9_Pag=E8s?=)
Date: Wed, 08 Feb 2012 17:36:18 -0800
Subject: [Rd] capture.output() is trying to allocate 17179869182.6 Gb on
 my not so big data.frame
In-Reply-To: <20274.14454.843172.560335@stat.math.ethz.ch>
References: <4F31BCED.7040506@fhcrc.org> <4F31EC9D.9020004@fhcrc.org>
	<20274.14454.843172.560335@stat.math.ethz.ch>
Message-ID: <4F332312.6060105@fhcrc.org>

Thanks Martin.  H.

On 02/08/2012 12:55 AM, Martin Maechler wrote:
>>>>>> Martin Morgan<mtmorgan at fhcrc.org>
>>>>>>      on Tue, 7 Feb 2012 19:31:41 -0800 writes:
>
>      >  On 02/07/2012 04:08 PM, Herv? Pag?s wrote:
>      >>  Hi,
>      >>
>      >>  This is what I get with recent R devel on a 64-bit Ubuntu laptop:
>      >>
>      >>  >  mydf<- data.frame(a=1:2080, b=1001:2040, c=letters, d=LETTERS,
>      >>  e=1:1040)
>      >>  >  mydf_in_a_character_vector<- capture.output(mydf)
>      >>  Error in print.default(m, ..., quote = quote, right = right) :
>      >>  cannot allocate memory block of size 17179869182.6 Gb
>
>      >  The error is thrown inside src/main/printarray.c:425
>
>      >  Rprintf("%*s%s", R_print.gap, "",
>      >          EncodeString(x[i + j * r], w[j], quote, right));
>
>      >  where the array w is the result of an unPROTECTed allocation earlier in
>      >  the function, and a garbage collection triggered in MatrixRowLabel (in
>      >  this case; allocation also occurs in MatrixColLabel, Rprintf).
>      >  PROTECTion seems to have been implemented in the file assuming that the
>      >  only allocations are at the head of the function; the return in the
>      >  _PRINT_DEAL_c_eq_0 macro makes it difficult to balance the protection
>      >  stack, and R_alloc seems to be a better solution anyway.
>
> yes, I think so too.
>
>      >  diff attached.
>
> I'm testing that and will commit.. if things seem fine.
> Martin Maechler
>
>      >  Martin Morgan
>
>      >>
>      >>  I get something similar with R 2.14.1.
>      >>
>      >>  Cheers,
>      >>  H.
>      >>
>      >>  >  sessionInfo()
>      >>  R Under development (unstable) (2012-01-16 r58124)
>      >>  Platform: x86_64-unknown-linux-gnu (64-bit)
>      >>
>      >>  locale:
>      >>  [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>      >>  [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
>      >>  [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
>      >>  [7] LC_PAPER=C LC_NAME=C
>      >>  [9] LC_ADDRESS=C LC_TELEPHONE=C
>      >>  [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>      >>
>      >>  attached base packages:
>      >>  [1] stats graphics grDevices utils datasets methods base
>      >>
>
>
>      >  --
>      >  Computational Biology
>      >  Fred Hutchinson Cancer Research Center
>      >  1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
>
>      >  Location: M1-B861 Telephone: 206 667-2793 x external: printarray.c.diff
>      >  text/x-patch, u [Click mouse-2 to display text]
>      >  ______________________________________________ R-devel at r-project.org
>      >  mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Herv? Pag?s

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



[Rd] capture.output() is trying to allocate 17179869182.6 Gb on my not so big data.frame
=?ISO-8859-1?Q?Herv=E9_Pag=E8s?=