[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Process.setrlimit question

ara.t.howard

1/15/2008 2:43:00 AM


why does this not blow up?

cfp:~ > cat a.rb
require 'yaml'

factor = 100000000000000000

soft, hard = Process.getrlimit Process::RLIMIT_RSS
y 'soft' => soft, 'hard' => hard

Process.setrlimit Process::RLIMIT_RSS, soft/factor, hard/factor

soft, hard = Process.getrlimit Process::RLIMIT_RSS
y 'soft' => soft, 'hard' => hard

s = 42.chr * (soft + 1)
s[-1]


cfp:~ > sudo ruby a.rb; echo $?
---
hard: 9223372036854775807
soft: 9223372036854775807
---
hard: 92
soft: 92
0


i sort of expect this to get signaled and throw an exception?

cheers

a @ http://draw...
--
sleep is the best meditation.
h.h. the 14th dalai lama




5 Answers

Daniel Berger

1/15/2008 3:08:00 AM

0

On Jan 14, 7:42 pm, "ara.t.howard" <ara.t.how...@gmail.com> wrote:
> why does this not blow up?
>
> cfp:~ > cat a.rb
> require 'yaml'
>
> factor = 100000000000000000
>
> soft, hard = Process.getrlimit Process::RLIMIT_RSS
> y 'soft' => soft, 'hard' => hard
>
> Process.setrlimit Process::RLIMIT_RSS, soft/factor, hard/factor
>
> soft, hard = Process.getrlimit Process::RLIMIT_RSS
> y 'soft' => soft, 'hard' => hard
>
> s = 42.chr * (soft + 1)
> s[-1]
>
> cfp:~ > sudo ruby a.rb; echo $?
> ---
> hard: 9223372036854775807
> soft: 9223372036854775807
> ---
> hard: 92
> soft: 92
> 0
>
> i sort of expect this to get signaled and throw an exception?

What platform?

Dan

ara.t.howard

1/15/2008 3:28:00 AM

0


On Jan 14, 2008, at 8:07 PM, Daniel Berger wrote:

> What platform?

osx - tiger

a @ http://draw...
--
sleep is the best meditation.
h.h. the 14th dalai lama




Daniel Berger

1/15/2008 5:18:00 AM

0

On Jan 14, 8:28 pm, "ara.t.howard" <ara.t.how...@gmail.com> wrote:
> On Jan 14, 2008, at 8:07 PM, Daniel Berger wrote:
>
> > What platform?
>
> osx - tiger

setrlimit() doesn't work on OS X.

Regards,

Dan

ara.t.howard

1/15/2008 5:26:00 AM

0


On Jan 14, 2008, at 10:17 PM, Daniel Berger wrote:

> setrlimit() doesn't work on OS X.

well gosh - that'd explain it - doh! ;-)

seriously though - you'd think it'd throw like fork does on windows
though eh?

thanks a bunch!

a @ http://codeforp...
--
it is not enough to be compassionate. you must act.
h.h. the 14th dalai lama




Daniel Berger

1/16/2008 12:08:00 AM

0

ara.t.howard wrote:
>
> On Jan 14, 2008, at 10:17 PM, Daniel Berger wrote:
>
>> setrlimit() doesn't work on OS X.
>
> well gosh - that'd explain it - doh! ;-)
>
> seriously though - you'd think it'd throw like fork does on windows
> though eh?

You would think. I've hit other situations like this with OS X, too. :(

Regards,

Dan