Process.setrlimit question

A

ara.t.howard

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://drawohara.com/
 
D

Daniel Berger

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
 
D

Daniel Berger

ara.t.howard said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] dike-0.0.3 2
[ANN] threadify-0.0.1 18
[ANN] threadify-0.0.3 0
[ANN] systemu-1.0.0 2
[ANN] bj-1.0.0 0
ANN main-4.4.0 0
[ANN] forkoff - parallel processing for ruby enumerables 20
[ANN] attributes-3.3.0 0

Members online

Forum statistics

Threads
474,276
Messages
2,571,384
Members
48,073
Latest member
ImogenePal

Latest Threads

Top