Skip to content

R 2.10 'memory leak'? on OS X

6 messages · Duncan Murdoch, Steven Yen, David Winsemius

#
Dear R users,

I am running R 2.10.0 on OS X 10.5.8.

I had been running 2.10 successfully for about a week (and have used
previous R versions for 2+ years on the same computer) until 2 days ago it
failed to start up for me. Now when I try to start R, the application tries
to initiate for several minutes then crashes. Looking at the activity
monitor, my memory usage goes from having about 1.6Gb free (out of 2Gb) to
<7Mb in the first 10-15 seconds of attempting to start the program. At this
point I either have to force quit R (as everything starts to freeze up) or
wait several minutes for it to crash.

I have erased the application and reinstalled it 4 times now - with exactly
the same result. I looked around in the Library and System folders to see if
any other files needed to be removed, but couldn't find any. I have also
restarted the computer and repaired permissions multiple times - and then
reinstalled R, with no luck. The exact same thing happens if I start R64.

I did not updated OS X or R, or install any other programs, just prior to
this first happening and am at a loss to explain what's going on. I have
copied the first part of one of the crash logs below. Does anyone have any
ideas for to remedy this?

best,

Steve


#---------------- Crash log ------------------------
Process:         R [231]
Path:            /Applications/R.app/Contents/MacOS/R
Identifier:      org.R-project.R
Version:         R 2.10.0 GUI 1.30 Leopard build 32-bit (5511)
Code Type:       X86 (Native)
Parent Process:  launchd [101]

Date/Time:       2009-11-18 23:15:45.570 -0500
OS Version:      Mac OS X 10.5.8 (9L31a)
Report Version:  6
Anonymous UUID:  D86CDCBC-00FD-4AEE-AB50-2EFE0DAE9E1E

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000067ee2
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib             0xffff07c7 __memcpy + 39
(cpu_capabilities.h:246)
1   com.apple.CoreFoundation       0x96a6a0b4 __CFStringEncodeByteStream +
4052
2   com.apple.Foundation           0x94446eb7
-[NSString(NSStringOtherEncodings)
getBytes:maxLength:usedLength:encoding:options:range:remainingRange:] + 295
3   com.apple.Foundation           0x94446a1a _NSNewStringByAppendingStrings
+ 538
4   com.apple.Foundation           0x94446760 -[NSString
stringByAppendingString:] + 192
5   org.R-project.R               0x00009ce8 -[RController doLoadHistory:] +
808
6   org.R-project.R               0x000076df -[RController awakeFromNib] +
2319
7   com.apple.CoreFoundation       0x96ac07f5 -[NSSet
makeObjectsPerformSelector:] + 181
8   com.apple.AppKit               0x92efed8e -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] + 1533
9   com.apple.AppKit               0x92ef4fba loadNib + 264
10  com.apple.AppKit               0x92ef491c +[NSBundle(NSNibLoading)
_loadNibFile:nameTable:withZone:ownerBundle:] + 946
11  com.apple.AppKit               0x92ef455f +[NSBundle(NSNibLoading)
loadNibFile:externalNameTable:withZone:] + 171
12  com.apple.AppKit               0x92ef449d +[NSBundle(NSNibLoading)
loadNibNamed:owner:] + 391
13  org.R-project.R               0x00002538 main + 296
14  org.R-project.R               0x000023d6 start + 54
#----------------------------------------------------------------------
#
On 20/11/2009 12:33 AM, Stropharia wrote:
It sounds like one of your user-specific startup files is causing the 
problem, e.g. .RData, or .Rprofile.  Did you try starting R with option 
--vanilla?  That will skip them.

Duncan Murdoch
#
Thanks Duncan,

I managed to get R to start through the terminal this way. Still no luck
getting the R.app to start. Is it possible to directly access (and then
trash or modify) the .RData and .RProfile files? I assume they would be
recreated if I could then open the R.app. Having searched for them on
spotlight and in the /user/library folder, I don't see them anywhere - are
they always located in the same place on OS X?

thanks,

Steve
Duncan Murdoch-2 wrote:

  
    
#
On 20/11/2009 10:38 AM, Stropharia wrote:
.RProfile won't be recreated:  it's where you put your own startup 
customizations.  It sounds as though .RData is a more likely culprit.

.RData is created when you quit and reply Yes to the question about 
saving.  I forget if there are special rules on a Mac about where the 
saving occurs, but on other systems it's in the current working 
directory.  On startup, R will look there and in the user's home 
directory. 

You probably want to ask on R-sig-mac for some Mac specific advice.

Duncan Murdoch
#
Probably best further discussed on R-SIG-Mac list:

https://stat.ethz.ch/mailman/listinfo/r-sig-mac

... since that is where the tricks of convincing MacOSX to display  
system files is discussed and a semi-regular basis:

https://stat.ethz.ch/pipermail/r-sig-mac/2009-November/006768.html

https://stat.ethz.ch/pipermail/r-sig-mac/2009-March/005925.html
#
Thanks a lot Duncan and David, the remedy was to delete the files .Rhistory
and .RData via the terminal - with "rm . Rhistory" etc. (By default they are
hidden on OS X.) Now R.app opens fine.

best,

Steve
David Winsemius wrote: