s-news
[Top] [All Lists]

Re: S-Plus Memory

To: Andreas Johansson <Andreas.Johansson@raidllp.com>
Subject: Re: S-Plus Memory
From: Tony Plate <tplate@blackmesacapital.com>
Date: Tue, 09 Jan 2007 16:52:43 -0700
Cc: S-news <s-news@lists.biostat.wustl.edu>
In-reply-to: <18E73B32A046C141A752E6DA39B1EB5202DCE538@MBAMMAIL.mbam.local>
References: <18E73B32A046C141A752E6DA39B1EB5202DCE538@MBAMMAIL.mbam.local>
User-agent: Mozilla Thunderbird 1.0.5 (Windows/20050711)
Just as a data point, using S-PLUS 7.0, running under Windows XP SP2, with the /3GB switch in boot.ini, I was able to allocate close to 3Gb in an S-PLUS session. One thing I found that was necessary to get larger amounts of memory allocated was to make sure that the bigdata library was not loaded. (There is an option in the GUI to not load the bigdata library.)

Here's the function I use to quickly test how much memory can be allocated:

exhaust.mem <- function(from = 128, to = 1, units = 2^20, verbose = F)
{
        # Exhaust memory by allocating as many vectors as possible,
        # starting with vectors of (from*units) bytes, and halving
        # the size of vectors when no more can be allocated.  Stop
        # when we get down to vectors of less than (to*units) bytes.
        # Return a summary of the memory allocated.
        mem.tally.reset()
        # find a nice name for the units (which are in bytes)
        i <- which(2^c(30, 20, 10, 0) <= units)[1]
        m <- units/2^(10 * (4 - i))
units.desc <- paste(if(m != 1) format(round(m, digits = 2)), c("G", "M", "K", "")[i], "b", sep = "")
        # how many different sized chunks? set up a vector to count them
        n <- floor(log(from/to)/log(2)) + 1
        count <- integer(n)
names(count) <- format(round(from/2^seq(len = n, from = 0), digits = 2), justify = "none")
        total <- 0
        k <- 1
        # indexes count
        # a list to store all the memory chunks we allocate
        chunks <- vector("list", 1000)
        chunk.i <- 1
        # start trying to allocate the biggest chunks first
        size <- from
        while(size >= to) {
                while(!is(try(x <- double((size * units)/8)), "Error")) {
                        if(verbose)
cat("Allocated ", size, units.desc, ", mem.tally=", round(mem.tally.report()[2]/units), "\n", sep = "")
                        chunks[[chunk.i]] <- x
                        chunk.i <- chunk.i + 1
                        if(chunk.i > length(chunks))
                                chunks <- c(chunks, vector("list", 1000))
                        total <- total + size
                        count[k] <- count[k] + 1
                }
                # get ready for the next iteration
                size <- size/2
                k <- k + 1
        }
list(units = c(size = units.desc, bytes = units), count = count, total = total, mem.tally = mem.tally.report()[2]/units)
}

-- Tony Plate


Andreas Johansson wrote:
Have been playing around with S-Plus memory in S-Plus 8 (on 32-bit XP). Have noticed a few problems especially when using the Workbench.

   1. Have 4GB of RAM with the /3GB switch (in boot.ini) enabling me to
      allocate 3GB to a single process. Still I can never manage to
      allocate more than 2GB to S-Plus. Even though some background
      processes takes up some memory I have about 2.7GB out of those 3GB
      available for sure, have also turned paging off (should not matter
      here).
   2. Using the workbench I cannot allocate more than 1GB for same
      setup. Have also tried setting options("memory") to higher values
      but changes nothing.

Does anyone know of why S-Plus cannot grab all available RAM? Is anyone using the 64-bit version on a Linux platform with more than 4GB of RAM and would like to share some performance stats? Andreas *Andreas Johansson*
Quantitative Analyst
MBAM
4th Floor, 11 Old Jewry
London EC2R 8DU
Andreas.Johansson@mbamfunds.com <mailto:Andreas.Johansson@mbamfunds.com>
Tel. (+44)20 7071 3351
Fax. (+44)20 7509 7454
This message is intended only for the use of the person(s) to whom it is addressed. It may contain information which is privileged and confidential. Accordingly any unauthorised use is strictly prohibited. If you are not the intended recipient, please contact the sender as soon as possible.

It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction, unless specifically agreed otherwise. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any opinions or advice contained in this Internet email are subject to the terms and conditions expressed in any applicable governing Marble Bar Asset Management LLP's terms and conditions of business or client agreement letter. Any comments or statements made herein do not necessarily reflect those of Marble Bar Asset Management LLP.

Marble Bar Asset Management LLP is regulated and authorised by the FSA.


<Prev in Thread] Current Thread [Next in Thread>