rinda and ruby numbers

Discussion in 'Ruby' started by Xaea Alvein, Aug 28, 2006.

  1. Xaea Alvein

    Xaea Alvein Guest

    1. is there any way to pre-allocate memory used by tuplespace, or is the
    memory used automatically set depending on the machine's free memory?

    2. it is said that ruby numbers' sizes aren't fixed, and depend on
    system's free memory. is there any ruby switch or something that can set
    the sizes statically, and not "manually" by bitwising the numbers?

    --
    Posted via http://www.ruby-forum.com/.
    Xaea Alvein, Aug 28, 2006
    #1
    1. Advertising

  2. Memory allocation is not your concern unless you are using the C API.
    Memory is allocated as required and dead objects are garbage collected.
    Although process memory will not yet shrink in Ruby (it doesn't have a
    compacting garbage collector) it will be reused for new objects. Ruby
    numbers will automatically generate instances of Bignum for any
    operation which would overflow the range of a Fixnum object. The effect
    of this is they grow as required to fit large numbers.

    What exactly do you want to do? Maybe we can help if you explain your
    problem.

    Xaea Alvein wrote:
    > 1. is there any way to pre-allocate memory used by tuplespace, or is the
    > memory used automatically set depending on the machine's free memory?
    >
    > 2. it is said that ruby numbers' sizes aren't fixed, and depend on
    > system's free memory. is there any ruby switch or something that can set
    > the sizes statically, and not "manually" by bitwising the numbers?
    >
    > --
    > Posted via http://www.ruby-forum.com/.
    Timothy Goddard, Aug 28, 2006
    #2
    1. Advertising

  3. Xaea Alvein

    Xaea Alvein Guest

    i am trying to control the behaviour of my tuplespace items (objects put
    into tuplespace) by assuring that the sizes of the items are static
    (i.e. numbers won't change class into Bignum from Fixnum, etc). so aside
    bitwising, is there any other method to manipulate those numbers (ruby
    switches maybe)?

    Timothy Goddard wrote:
    > Memory allocation is not your concern unless you are using the C API.
    > Memory is allocated as required and dead objects are garbage collected.
    > Although process memory will not yet shrink in Ruby (it doesn't have a
    > compacting garbage collector) it will be reused for new objects. Ruby
    > numbers will automatically generate instances of Bignum for any
    > operation which would overflow the range of a Fixnum object. The effect
    > of this is they grow as required to fit large numbers.
    >
    > What exactly do you want to do? Maybe we can help if you explain your
    > problem.



    --
    Posted via http://www.ruby-forum.com/.
    Xaea Alvein, Aug 30, 2006
    #3
  4. Xaea Alvein

    Eric Hodel Guest

    On Aug 29, 2006, at 6:04 PM, Xaea Alvein wrote:

    > Timothy Goddard wrote:
    >> Memory allocation is not your concern unless you are using the C API.
    >> Memory is allocated as required and dead objects are garbage =20
    >> collected.
    >> Although process memory will not yet shrink in Ruby (it doesn't =20
    >> have a
    >> compacting garbage collector) it will be reused for new objects. Ruby
    >> numbers will automatically generate instances of Bignum for any
    >> operation which would overflow the range of a Fixnum object. The =20
    >> effect
    >> of this is they grow as required to fit large numbers.
    >>
    >> What exactly do you want to do? Maybe we can help if you explain your
    >> problem.

    >
    > i am trying to control the behaviour of my tuplespace items =20
    > (objects put
    > into tuplespace) by assuring that the sizes of the items are static
    > (i.e. numbers won't change class into Bignum from Fixnum, etc). so =20
    > aside
    > bitwising, is there any other method to manipulate those numbers (ruby
    > switches maybe)?


    A Fixnum is always a Fixnum, and a Bignum is always a Bignum. If you =20=

    subtract one from a Bignum at the Bignum/Fixnum boundary you'll get a =20=

    Fixnum, and vice versa. The number won't change class underneath you =20=

    (5 will always be a Fixnum, never a Bignum).

    If you want to move the boundary switch from or to a 32 bit machine.

    --=20
    Eric Hodel - - http://blog.segment7.net

    A: Yes
    Q: Is top-posting bad?
    =97 Derek Milhous Zumsteg
    Eric Hodel, Aug 31, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Calum Shaw-Mackay

    Druby , Rinda and Jini language bindings

    Calum Shaw-Mackay, Mar 1, 2005, in forum: Ruby
    Replies:
    0
    Views:
    94
    Calum Shaw-Mackay
    Mar 1, 2005
  2. Alexander Lamb

    Rinda and notifications example?

    Alexander Lamb, Oct 26, 2005, in forum: Ruby
    Replies:
    1
    Views:
    129
    Eric Hodel
    Oct 26, 2005
  3. Joe Hosteny iv
    Replies:
    0
    Views:
    123
    Joe Hosteny iv
    Oct 9, 2006
  4. Enrique Comba Riepenhausen

    Distributed Ruby/Threads/Rinda?

    Enrique Comba Riepenhausen, May 12, 2007, in forum: Ruby
    Replies:
    0
    Views:
    94
    Enrique Comba Riepenhausen
    May 12, 2007
  5. Hema Latha
    Replies:
    5
    Views:
    242
    Eleanor McHugh
    Oct 7, 2007
Loading...

Share This Page