[R] memory problem
Huntsinger, Reid
reid_huntsinger at merck.com
Wed Dec 8 18:06:29 CET 2004
OK, I would do the following:
1. Watch memory usage as the program runs, both within R and at the OS level
for the R process. I suppose your code allocates memory (eg with "new")
within the R process but the R memory manager knows nothing about it. So you
can tell where memory is leaking, if at all.
2. write a dummy .so to return constant values, doing no computation, but
using the same interface. If you still have the problem then you have a
problem with the R code.
If this got me nowhere I would start R under gdb and look around. The
"Writing R Extensions" has a section on this.
Reid
-----Original Message-----
From: Samuel Kemp [mailto:sam.kemp2 at ntlworld.com]
Sent: Wednesday, December 08, 2004 11:46 AM
To: Huntsinger, Reid
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] memory problem
Thanks.
Here is some more information.....
My platform is a Linux desktop.
The C++ code implements a Gamma test which is calculated by constructing
near neighbour lists (kd-tree) - the C++ code returns the deltas and
gammas, the R code gets the noise estimate of the data by doing a linear
regression on these deltas and gammas. However, at the end of my C++
code I do delete all objects on the free store.
This Gamma test code should be called 16,000 times but R crashes after
about 14,000, with "killed".
Huntsinger, Reid wrote:
>Some additional details would help. What platform? What does the C++ code
do
>that might cause a memory leak? How are you calling it?
>
>I don't see why unloading the library would free memory even if it were
>allocated outside R's memory management. Unless you're using Windows you
>don't need to worry about allocating memory for R, just check that there
are
>no limits on memory allocation set by the administrator.
>
>Reid Huntsinger
>
>-----Original Message-----
>From: r-help-bounces at stat.math.ethz.ch
>[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Samuel Kemp
>Sent: Wednesday, December 08, 2004 6:29 AM
>To: r-help at stat.math.ethz.ch
>Subject: [R] memory problem
>
>
>Hi,
>
>I am trying to run a very computationally expensive procedure in
>R-2.0.0. and the process always gets killed after approx 8 minutes. This
>procedure calls some of my own C++ code - in case it was this code
>causing a memory leak I unload and then reload the .so file every time,
>however I still get the same problem. The procedure is run 16000 times
>and always calls the lm() function. My believe at the moment is that I
>need to allocate more memory for R - is this correct? I did try envoking
>R from the command line using R --min-vsize=1000M, however still no luck.
>
>I have googled around and looked at the help files, but I am still
>confused about how to fix this problem.
>
>Any insight would be greatly appeciated.
>
>Kind Regards,
>
>Sam.
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide!
>http://www.R-project.org/posting-guide.html
>
>
>
>---------------------------------------------------------------------------
---
>Notice: This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
Jersey, USA 08889), and/or its affiliates (which may be known outside the
United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as
Banyu) that may be confidential, proprietary copyrighted and/or legally
privileged. It is intended solely for the use of the individual or entity
named on this message. If you are not the intended recipient, and have
received this message in error, please notify us immediately by reply e-mail
and then delete it from your system.
>---------------------------------------------------------------------------
---
>
>
>
More information about the R-help
mailing list