Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
rinda and ruby numbers
Xaea Alvein
8/28/2006 4:31:00 AM
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-...
.
3 Answers
Timothy Goddard
8/28/2006 7:46:00 AM
0
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-...
.
Xaea Alvein
8/30/2006 1:05:00 AM
0
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-...
.
Eric Hodel
8/30/2006 11:47:00 PM
0
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
>> 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.
>
> 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)?
A Fixnum is always a Fixnum, and a Bignum is always a Bignum. If you
subtract one from a Bignum at the Bignum/Fixnum boundary you'll get a
Fixnum, and vice versa. The number won't change class underneath you
(5 will always be a Fixnum, never a Bignum).
If you want to move the boundary switch from or to a 32 bit machine.
--
Eric Hodel - drbrain@segment7.net -
http://blog.se...
A: Yes
Q: Is top-posting bad?
— Derek Milhous Zumsteg
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
rinda and ruby numbers
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password