[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Errno::ENOMEM reading a device in Ruby, not in Java though

Yukihiro Matsumoto

1/29/2009 5:51:00 PM

Hi,

In message "Re: Errno::ENOMEM reading a device in Ruby, not in Java though"
on Thu, 29 Jan 2009 14:47:11 +0900, Heesob Park <phasis@gmail.com> writes:

|The another difference between ruby and java is read buffer size.
|Ruby's buffer size is 4096 and java's buffer size is 65536.
|
|The man page of st says:
|
|RETURN VALUE
|
| ENOMEM The byte count in read() is smaller than the next physi-
| cal block on the tape. (Before 2.2.18 and 2.4.0-test6 the
| extra bytes have been silently ignored.)

I didn't know that. In that case, you have to pre-allocate reading
buffer (string) and specify it to read method.

matz.

1 Answer

Roger Pack

1/29/2009 8:41:00 PM

0

ge of st says:
> |
> |RETURN VALUE
> |
> | ENOMEM The byte count in read() is smaller than the next physi-
> | cal block on the tape. (Before 2.2.18 and 2.4.0-test6 the
> | extra bytes have been silently ignored.)
>
> I didn't know that. In that case, you have to pre-allocate reading
> buffer (string) and specify it to read method.

Interesting.
Perhaps somebody with brighter eyes can help me out with this?
[how to?]

a = File.open '/dev/nst2'
>> b = 'a'*129000
>> a.read b
TypeError: can't convert String into Integer
>> a.read 65000
Errno::ENOMEM: Cannot allocate memory - /dev/nst2

Also thinking out loud I wonder why java has 64kB blocks and ruby 4k? is
64 k any other benefit?

Thanks!
-=r
--
Posted via http://www.ruby-....