From tlumley@u.washington.edu  Wed Apr 18 20:08:00 2001
From: tlumley@u.washington.edu (Thomas Lumley)
Date: Wed, 18 Apr 2001 12:08:00 -0700 (PDT)
Subject: [Rd] Freeing memory used by R.
In-Reply-To: <ABB64B4C48ECD44CADC72FA840118B3B5039@athena.Bend.IntelliChem.com>
Message-ID: <Pine.A41.4.33.0104181202440.16584-100000@homer22.u.washington.edu>

On Wed, 18 Apr 2001, Don Wingate wrote:

> Hello R developers,
>
> Windows 2000
> R Version 1.2.2
>
> I am running using R.dll in a Windows application.  It is loaded into memory
> when needed, used as required, and then (hopefully) destroyed while the
> application continues with other, unrelated activities.  The problem is that
> I can't find any way to free all memory used by R without terminating the
> process in which R is running, which I cannot do because that would also
> kill the host application.  Is there a way to locate and free all memory
> allocated by R.dll, leaving the host process intact?
>

In general you can't release memory to the operating system: under most
malloc's and most OS's the memory you free() just stays allocated.  You
might be able to unload the R dll; I don't know what effect that has under
Windows.

However, any halfway competent virtual memory system (which nowadays does
include Windows) will end up paging out the memory if it is never used, so
it shouldn't help much even if you could release all the memory.

	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Freeing memory used by R.
Thomas Lumley