Re: too much memory use!
- Posted by euman at bellsouth.net Feb 19, 2002
- 582 views
Hey Kat, lets see, your looking for these {10,13,32} or {Line Feed, Carriage Return, Space} right? What if you tried using find like this for starters: loc = find({10,13,32},readline[1..length(readline)]) readline = readline[1..loc] instead of: find(readline[length(readline)],{10,13,32}) readline = readline[1..length(readline)-1] second, I have no idea what "parse" does eg, junk_s = parse(readline,32) third, you sure are making alot of sequence copy, concat operations in this routine. finally, this is a bit strange coming from your caliber Kat. while find(readline[length(readline)],{10,13,32}) do readline = readline[1..length(readline)-1] end while your saying while I find this {10,13,32} at the end of readline copy readline[1..to length(readline)]-1 until I dont find it.....hmmmm Kat think about it! Euman euman at bellsouth.net Q: Are we monetarily insane? A: YES ----- Original Message ----- From: "Kat" <gertie at PELL.NET> To: "EUforum" <EUforum at topica.com> Sent: Wednesday, February 20, 2002 12:17 AM Subject: too much memory use! > > Eu took 29 minutes, 36 sec to execute the following program, and used > 142.7Megs of memory. The file it was reading is 12.1 megabytes. > > data = {} > datafile = open(data_noun,"u") > readline = gets(datafile) -- get a line > while not atom(readline) do > while find(readline[length(readline)],{10,13,32}) do readline = > readline[1..length(readline)-1] end while > junk_s = parse(readline,32) > data = data & {junk_s} > readline = gets(datafile) -- get another line > end while > close(datafile) > trace(1) -- to hold the program while getting memory use data > abort(0) > > What am i doing that runs a 12meg file up to 142.7megabytes? and takes > 1/2 hour to do it? > > How can i say data = glom(file) ? > > Kat > > > >