Re: out of memory, even tho remembered nothing!

new topic     » goto parent     » topic index » view thread      » older message » newer message


Well, anyhow, this fails to run properly also:

junk = gets(readfile) 
while sequence(junk) do 
  size += length(junk) 
  puts(1,sprintf("%d",size)&"\r") 
  junk = gets(readfile) 
end while 


I looked in io.e for what EOF is when gets() hits the end of the file:

From docs on gets() -

Returns: An object, either EOF on end of file, or the next line of text from the file.

and from io.e -

public constant EOF = (-1)

And so i am still tripping over typecasting. To me, -1 is not a sequence, nor should it be TRUE. To avoid the horrors like this, the following convoluted while must be used:

junk = gets(readfile) 
while not equal(-1,junk) do 
  size += length(junk) 
  puts(1,sprintf("%d",size)&"\r") 
  junk = gets(readfile) 
end while 


If it's voteable, i vote for replacing "while not equal(-1,junk) do" with "while junk do".

Anyhoo, this is getting off my original point, and i am glad Matt is fixing the memory leak in gets().

useless

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu