R crashes with package SJava; was [R] Memory leakage?

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 8 16:55:16 CEST 2003


On Thu, 8 May 2003, Hotz, T. wrote:

> As is visible from the output, I set JAVA_HOME properly 
> in my .Renviron file. Otherwise I couldn't even call .Java(). 
> However, I use R 1.6.2, maybe that's the problem (although the
> SJava version I use was built for R 1.6.2). Example calc() 
> doesn't cause R to crash, but gives me the following warning
> when called twice:
> 
> Warning message: 
> `restart' is deprecated.
> Use `try' instead.
> See ?Deprecated. 

That's because the code in calc.R is old (pre R 1.6.0).

> Moreover, I don't really understand the example: where am I
> supposed to get the result of the calculation? I don't see it
> in the Java Dialog, and can't spot it in the return value 
> either.

Simon Urbanek told me that was a bug in the Java code for that example 
....

> Regards
> 
> Thomas
> 
> -----Original Message-----
> From: Christian Schulz [mailto:ozric at web.de]
> Sent: 08 May 2003 14:46
> To: Hotz, T.; r-help at stat.math.ethz.ch
> Subject: Re: R crashes with package SJava; was [R] Memory leakage?
> 
> 
> Hmm,
> 
> this steps run without problems on my locale win2k.
> Perhaps you make the same mistake like me in the past
> and have no file named .Renviron  with entry
> 
> JAVA_HOME = c:/YourPath/j2re1.4.1_02
> 
> and saved in \rw1070 ?
> 
> >> library(sjava)
> using JAVA_HOME = c:/Programme/Java/j2re1.4.1_02
> >>.JavaInit()
> >>source("C:/Chris/dm/rw1070/library/SJava/examples/calc.R")
> >>calc()
> [[1]]
> $id
> [1] "1"
> 
> $value
> $value$actionPerformed
> function(ev) {
>    txt <- ev$getActionCommand()
>    back <- 0
>    if(txt == "=") {
>      txt <- input$getText()
>      val <- as.character(eval(parse(text=txt)))
>      input$setText(val)
>      jcombo$getModel()$insertElementAt(txt, as.integer(0))
>      return(NULL)
>    } else if(!is.na(match(txt, unaryOps))) {
>      if(txt == "()")
>        txt <- ""
>      val <- paste(txt, "()",sep="")
>      back <- -1
>    } else if(txt == "Clear") {
>       input$setText("")
>       return(NULL)
>    } else {
>      val <- txt
>    }
> 
>     doc <- input$getDocument()
>     doc$insertString(input$getCaretPosition(), val, NULL)
>     if(back < 0) {
>       input$setCaretPosition(as.integer(input$getCaretPosition() + back))
>     }
>  }
> <environment: 0194B3CC>
> 
> 
> $className
> character(0)
> 
> $targetClasses
> character(0)
> 
> attr(,"class")
> [1] "AnonymousRReference"
> 
> $input
> $key
> [1] "67"
> 
> $className
> [1] "javax.swing.plaf.metal.MetalComboBoxEditor$1"
> 
> attr(,"class")
> [1] "AnonymousOmegahatReference"
> 
> >>calc()
> 
> 
> 
> ----- Original Message -----
> From: "Hotz, T." <th50 at leicester.ac.uk>
> To: <r-help at stat.math.ethz.ch>
> Cc: "Duncan Murdoch" <dmurdoch at pair.com>; <tshi at itsa.ucsf.edu>
> Sent: Thursday, May 08, 2003 3:04 PM
> Subject: R crashes with package SJava; was [R] Memory leakage?
> 
> 
> > Dear all,
> >
> > Maybe this has something to do with R crashing?
> > When my R version crashes, there is Rgui.exe still
> > running in the background (i.e. W2K's task manager
> > recognises it only as a process, which apparently
> > is using almost 100% of the CPU).
> >
> > I can reproduce that by "using" the SJava package
> > (from Brian Ripley's homepage, as suggested on
> > http://www.omegahat.org/RSJava/). When loading the
> > package, and running the ttest example, my Rgui.exe
> > crashes, and I end up with the process Rgui.exe
> > still alive using the CPU extensively. The same
> > happens on my stand-alone machine at home (with the
> > same OS and R versions but newest Sun JDK).
> >
> > Any comments greatly appreciated.
> >
> > Best wishes
> >
> > Thomas
> >
> > P.S. At the end an error message appears, but I'm not
> > able to sink it. I could run it in a terminal - but
> > are there other possibilities?
> >
> > --- R code pasted into Rgui
> >
> > rm(list=ls())
> > # see below for ouput,
> > # used sink to get probale error messages
> > # (doesn't work; can one "sink" error messages?)
> > sink("k:/SJavaFault.rout")
> > version
> > # load SJava
> > library(SJava)
> > library(help=SJava)
> > .JavaInit()
> > # try SJava
> > .Java("Math","PI")
> > # load example
> > source("d:/R/rw1062/library/SJava/examples/ttest.R")
> > x<-rnorm(10)
> > y<-rnorm(10,1)
> > # test example, crashes after specifying x and y in the dialog and
> pressing "Submit"
> > dialog.t.test()
> > # Rgui.exe still running as a process, but not an application (according
> to task manager)
> >
> >
> > --- Output of sink and library(help=...)
> >
> >          _
> > platform i386-pc-mingw32
> > arch     i386
> > os       mingw32
> > system   i386, mingw32
> > status
> > major    1
> > minor    6.2
> > year     2003
> > month    01
> > day      10
> > language R
> > using JAVA_HOME = Y:/Java Development Kit/Java2sdk1.4/jre
> >
> > [...]
> > Package: SJava
> > Version: 0.65
> > Date: 2002/07/17
> > Title: The Omegahat interface for R and Java.
> > Author: Duncan Temple Lang <duncan at research.bell-labs.com>, John
> >         Chambers <jmc at research.bell-labs.com>
> > Depends: R (>= 1.1.0)
> > Maintainer: Duncan Temple Lang <duncan at research.bell-labs.com>
> > Description: An interface from R to Java to create and call Java
> >         objects and methods.
> > License: GPL version 2 or newer. http://www.gnu.org/copyleft/gpl.html
> > URL: http://www.omegahat.org/RSJava, http://www.omegahat.org
> >         http://www.omegahat.org/bugs
> > Built: R 1.6.2; Win32; Thu Feb 27 19:18:38 GMTST 2003
> > [...]
> >
> > [1] 3.141593
> > $id
> > [1] "1"
> >
> > $value
> > $value$actionPerformed
> > function(ev) {
> >    cmd <- ev$getActionCommand()
> >    if(cmd == "Reset")
> >      reset()
> >    else {
> >      print(compute())
> >    }
> >
> >   NULL
> >  }
> > <environment: 013B8AC4>
> >
> >
> > $className
> > character(0)
> >
> > $targetClasses
> > character(0)
> >
> > attr(,"class")
> > [1] "AnonymousRReference"
> >
> > ---
> >
> > Thomas Hotz
> > Research Associate in Medical Statistics
> > University of Leicester
> > United Kingdom
> >
> > Department of Epidemiology and Public Health
> > 22-28 Princess Road West
> > Leicester
> > LE1 6TP
> > Tel +44 116 252-5410
> > Fax +44 116 252-5423
> >
> > Division of Medicine for the Elderly
> > Department of Medicine
> > The Glenfield Hospital
> > Leicester
> > LE3 9QP
> > Tel +44 116 256-3643
> > Fax +44 116 232-2976
> >
> >
> > -----Original Message-----
> > From: Duncan Murdoch [mailto:dmurdoch at pair.com]
> > Sent: 03 May 2003 23:59
> > To: tshi at itsa.ucsf.edu
> > Cc: r-help at stat.math.ethz.ch
> > Subject: Re: [R] Memory leakage?
> >
> >
> > On Sat, 03 May 2003 20:33:49 +0000, you wrote:
> >
> > >I haven't tried re-installing windows yet, because it seems to be a big
> task
> > >for me and also I kind of doubt that the problem is due to my own
> > >computer(s), because the same problem happens to 3 different computers:
> one
> > >Dell desktop in school runing Win2K and R 1.6.1, my Dell laptop runing
> Win
> > >XP Professional Edition and R 1.7.0 and my new Dell desktop at home (just
> > >bought less than a month and only a few basic softwares were installed)
> > >runing Win XP Home Edition and R1.7.0.  (may be they're all from Dell
> :-))
> > >I'm still looking for the pattern of when this happens, but so far, it
> seems
> > >to be random.
> >
> > I don't think it's a Windows problem.  I've seen it occasionally, but
> > not reproducibly.  If you can figure out some sequence of operations
> > that reliably produces it, please let me know.
> >
> > Duncan Murdoch
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list