Does the following indicate that I have a memory leak?> gc(TRUE)Garbage collection 22891 = 21012+1557+322 (level 2) ... 483257 cons cells free (59%) 11.0 Mbytes of heap free (82%) used (Mb) gc trigger (Mb) Ncells 334906 9.0 818163 21.9 Vcells 309342 2.4 1746173 13.4> memory.size()/1024/1024 ## in MB[1] 643.8978> sum(sapply(ls(all.names=TRUE),object.size))[1] 1776> memory.limit()/1024/1024[1] 600 I was repeatedly using try(eval(substitute(nlme(..)))), with lots of error aborts from nlme. --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = x86 os = Win32 system = x86, Win32 status major = 1 minor = 3.1 year = 2001 month = 08 day = 31 language = R Windows 98 SE 4.10 (build 2222) A Search Path: .GlobalEnv, package:ctest, package:RBMDS, package:nls, package:nlme, Autoloads, package:base R. Woodrow Setzer, Jr. Phone: (919) 541-0128 Experimental Toxicology Division Fax: (919) 541-5394 Pharmacokinetics Branch NHEERL MD-74; US EPA; RTP, NC 27711 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 21 Sep 2001 Setzer.Woodrow at epamail.epa.gov wrote:> Does the following indicate that I have a memory leak? > > > gc(TRUE) > Garbage collection 22891 = 21012+1557+322 (level 2) ... > 483257 cons cells free (59%) > 11.0 Mbytes of heap free (82%) > used (Mb) gc trigger (Mb) > Ncells 334906 9.0 818163 21.9 > Vcells 309342 2.4 1746173 13.4 > > memory.size()/1024/1024 ## in MB > [1] 643.8978 > > sum(sapply(ls(all.names=TRUE),object.size)) > [1] 1776 > > memory.limit()/1024/1024 > [1] 600 > > I was repeatedly using try(eval(substitute(nlme(..)))), with lots of error > aborts from nlme.I don't think so. From CHANGES: The Windows memory manager proved to be (far) too slow to work with the new generational garbage collector, so it has been replaced. The current memory manager rarely releases memory back to Windows (but reuses memory very efficiently) so total memory usage will often grow slowly over the course of a session. Memory used for transient large objects will normally be returned at garbage collection. (Once memory usage has gone over the 256Mb of address space that is initially reserved, it is unlikely to be reduced much, but the allocated memory will be reused.) You can compile R to use the Windows memory manager if you need to. This behaviour is not ideal, but given the way Windows manages memory is not really compatible with the Unix model of a single large block that can be grown or shrunk by calls to sbrk, it is the best we can do with the human resources available. Getting this far was hard enough. (The speed hit with the Windows memory manager was often three or more.)> > --please do not edit the information below-- > > Version: > platform = i386-pc-mingw32 > arch = x86 > os = Win32 > system = x86, Win32 > status > major = 1 > minor = 3.1 > year = 2001 > month = 08 > day = 31 > language = R > > Windows 98 SE 4.10 (build 2222) A > > Search Path: > .GlobalEnv, package:ctest, package:RBMDS, package:nls, package:nlme, > Autoloads, package:base > > R. Woodrow Setzer, Jr. Phone: > (919) 541-0128 > Experimental Toxicology Division Fax: (919) 541-5394 > Pharmacokinetics Branch > NHEERL MD-74; US EPA; RTP, NC 27711 > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help 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-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks. Now that you mention it, I remember reading that note in CHANGES. It's getting harder to remember everything I need to! R. Woodrow Setzer, Jr. Phone: (919) 541-0128 Experimental Toxicology Division Fax: (919) 541-5394 Pharmacokinetics Branch NHEERL MD-74; US EPA; RTP, NC 27711 Prof Brian D Ripley To: Woodrow Setzer/RTP/USEPA/US at EPA <ripley at stats cc: r-help at hypatia.math.ethz.ch .ox.ac.uk> Subject: Re: [R] memory usage Sent by: ripley at auk.st ats 09/22/01 02:19 AM On Fri, 21 Sep 2001 Setzer.Woodrow at epamail.epa.gov wrote:> Does the following indicate that I have a memory leak? > > > gc(TRUE) > Garbage collection 22891 = 21012+1557+322 (level 2) ... > 483257 cons cells free (59%) > 11.0 Mbytes of heap free (82%) > used (Mb) gc trigger (Mb) > Ncells 334906 9.0 818163 21.9 > Vcells 309342 2.4 1746173 13.4 > > memory.size()/1024/1024 ## in MB > [1] 643.8978 > > sum(sapply(ls(all.names=TRUE),object.size)) > [1] 1776 > > memory.limit()/1024/1024 > [1] 600 > > I was repeatedly using try(eval(substitute(nlme(..)))), with lots oferror> aborts from nlme.I don't think so. From CHANGES: The Windows memory manager proved to be (far) too slow to work with the new generational garbage collector, so it has been replaced. The current memory manager rarely releases memory back to Windows (but reuses memory very efficiently) so total memory usage will often grow slowly over the course of a session. Memory used for transient large objects will normally be returned at garbage collection. (Once memory usage has gone over the 256Mb of address space that is initially reserved, it is unlikely to be reduced much, but the allocated memory will be reused.) You can compile R to use the Windows memory manager if you need to. This behaviour is not ideal, but given the way Windows manages memory is not really compatible with the Unix model of a single large block that can be grown or shrunk by calls to sbrk, it is the best we can do with the human resources available. Getting this far was hard enough. (The speed hit with the Windows memory manager was often three or more.)> > --please do not edit the information below-- > > Version: > platform = i386-pc-mingw32 > arch = x86 > os = Win32 > system = x86, Win32 > status > major = 1 > minor = 3.1 > year = 2001 > month = 08 > day = 31 > language = R > > Windows 98 SE 4.10 (build 2222) A > > Search Path: > .GlobalEnv, package:ctest, package:RBMDS, package:nls, package:nlme, > Autoloads, package:base > > R. Woodrow Setzer, Jr. Phone: > (919) 541-0128 > Experimental Toxicology Division Fax: (919)541-5394> Pharmacokinetics Branch > NHEERL MD-74; US EPA; RTP, NC 27711 > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-> r-help mailing list -- Readhttp://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html> Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._>-- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._