From baronshtam at lightminersystems.com  Tue Jan 14 23:46:03 2014
From: baronshtam at lightminersystems.com (Boris Aronshtam)
Date: Tue, 14 Jan 2014 22:46:03 +0000
Subject: [Rd] Passing a large array to .Call by reference
In-Reply-To: <21204.41070.388322.108514@max.nulle.part>
References: <9D80368C6A00834189C1982FB64EFA3007EE9361@ORD2MBX07C.mex05.mlsrvr.com>
	<21204.41070.388322.108514@max.nulle.part>
Message-ID: <9D80368C6A00834189C1982FB64EFA3007EE9381@ORD2MBX07C.mex05.mlsrvr.com>

Sorry for the post. My mistake. The further investigation shows that .Call() passes arrays/vectors by reference. 

-----Original Message-----
From: Dirk Eddelbuettel [mailto:edd at debian.org] 
Sent: Monday, January 13, 2014 6:27 PM
To: Boris Aronshtam
Cc: r-devel at r-project.org
Subject: Re: [Rd] Passing a large array to .Call by reference


On 14 January 2014 at 02:02, Boris Aronshtam wrote:
| I need to pass a large array to my C function. I am using .Call(). I can clearly see according to the memory consumption (reported by gc()) that the array is duplicated. Is there a way to avoid this duplication and pass the array by reference?

Staring at gc() is at approximate at best. 

R has memory profiling, see Writing R Extensions for how to use it.

There is no code in your post, so not much else I can comment on.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



[Rd] Passing a large array to .Call by reference
Boris Aronshtam