Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-14 Thread Honglang Wang
Thanks, Romain. Best wishes! Honglang Wang Office C402 Wells Hall Department of Statistics and Probability Michigan State University 1579 I Spartan Village, East Lansing, MI 48823 wangh...@msu.edu On Fri, Dec 14, 2012 at 11:04 AM, Romain Francois wrote: > I dont know. This looks like a deeply

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-14 Thread Romain Francois
I dont know. This looks like a deeply hidden problem. Maybe you can enable some rcpp debugging by adding #define RCPP_DEBUG_LEVEL 1 Before you include Rcpp.h, this will give you verbose output, maybe this will help locating the issue. Romain Envoyé de mon iPhone Le 14 déc. 2012 à 16:31,

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-14 Thread Honglang Wang
Hi Romain, Thanks very much. I tried your method. And now the old error has gone, which is really good for me. But a new error is : Error in betahat(ker, x, X, y, t, h, m) : (list) object cannot be coerced to type 'double' Calls: system.time ... apply -> FUN -> betahat -> .External -> cpp_excepti

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread Romain Francois
Le 14/12/12 03:15, Honglang Wang a écrit : Hi, Here is the sample code: // [[Rcpp::export]] List betahat(Function ker, double t0, NumericMatrix Xr, NumericMatrix yr, NumericVector tr, double h, int m) { int n = Xr.nrow(), p = Xr.ncol(); arma::mat X(Xr.begin(), n, p, false); arma::mat y(y

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread Honglang Wang
Hi Yan, Thanks a lot. Your advice is really the point for me. Have a good night. Best wishes! Honglang Wang Office C402 Wells Hall Department of Statistics and Probability Michigan State University 1579 I Spartan Village, East Lansing, MI 48823 wangh...@msu.edu On Thu, Dec 13, 2012 at 10:54 P

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread Yan Zhou
You really are not reading the list as close as you should be. If you want advice, then take it when people give it to you or stop asking. AFAIK, your code does not involve manually allocated memory, all memories are managed by RAII objects, I don't see where the question of "freeing memory" co

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread Honglang Wang
I am sorry that I was abusing this list. My point is 1) First, this code works for me for some simulation cases. I repeated the simulation 1000 times, which then called this Rcpp function 1000 times at least. And this code worked perfectly. 2) But in some other simulation case (here what I mean by

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread Dirk Eddelbuettel
Honglang, You are now abusing the free facilities offered by this list. Your examples are not self-contained [ no sample data or simulated data ] and hence not reproducible. Your code is complex, and not motivated. And we have told you REPEATEDLY to shorten your code to chunks until it works.

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread Honglang Wang
Hi, Here is the sample code: // [[Rcpp::export]] List betahat(Function ker, double t0, NumericMatrix Xr, NumericMatrix yr, NumericVector tr, double h, int m) { int n = Xr.nrow(), p = Xr.ncol(); arma::mat X(Xr.begin(), n, p, false); arma::mat y(yr.begin(), n, 1, false); arma::colvec t(tr.beg

Re: [Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread romain
Hello, What memory do you want to free ? Can you give an example of code where there is memory you'd like to "free" ? Romain Le 2012-12-13 22:52, Honglang Wang a écrit : Dear All, How to free memory in Rcpp? What's the command? Thanks. Best wishes!   Honglang Wang   Office C402 Wells Hall

[Rcpp-devel] How to free memory in Rcpp

2012-12-13 Thread Honglang Wang
Dear All, How to free memory in Rcpp? What's the command? Thanks. Best wishes! Honglang Wang Office C402 Wells Hall Department of Statistics and Probability Michigan State University 1579 I Spartan Village, East Lansing, MI 48823 wangh...@msu.edu ___ R