Re: [Rd] .Call and to reclaim the memory by allocVector

From: Seth Falcon <sfalcon_at_fhcrc.org>
Date: Sat, 25 Aug 2007 08:16:54 -0700

Hi Yongchao,

Yongchao Ge <Yongchao.Ge_at_mssm.edu> writes:
> Why am I storing a large dataset in the R? My program consist of two
> parts. The first part is to get the intermediate results, the computation
> of which takes a lot of time. The second part contains many
> different functions to manipulate the the intermediate
> results.
>
> My current solution is to save intermediate result in a temporary file,
> but my final goal is to to save it as an R object. The "memory leak" in
> .Call stops me from doing this and I'd like to know if I can have a clean
> solution for the R package I am writing.

There are many examples of packages that use .Call to create large objects. I don't think there is a "memory leak".

One thing that may be catching you up is that because of R's pass-by-value semantics, you may be ending up with multiple copies of the object on the R side during some of your operations. I would recommend recompiling with --enable-memory-profiling and using tracemem() to see if you can identify places where copies of your large object are occurring. You can also take a look at Rprof(memory.profile=TRUE).

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
BioC: http://bioconductor.org/
Blog: http://userprimary.net/user/

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sat 25 Aug 2007 - 16:32:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 29 Aug 2007 - 14:39:47 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.