Pastey simple gets(), and out of memory 1
- Posted by useless_ Oct 17, 2012
-- -- -- -- -- how big a file can be opened, and when will reading fail? -- -- include std/filesys.e -- for move, del, create, dir include std/console.e -- any_key() atom size = 0 object junk, junk1 , junk2 , junk3, readfile with trace sequence readfilename = "E:\\YAGO\\yago2core_20120109\\using.tsv" puts(1,"filesize actually read in with gets()\n\n") -- odd something else: winders says : 7.28 GB 7,823,038,472 bytes) -- when the app crashed, it printed out : size = 9009698613 -- how would it read 1.5 Gbytes past the end of the file? readfile = open(readfilename,"rb") while 1 do junk = gets(readfile) size += length(junk) -- out of memory here, size = 9009698613 puts(1,sprintf("%d",size)&"\r") end while close(readfile) puts(1,"\nwell, if i got here, there was no crash!\n\n") any_key() abort(0)


