Luc <
[email protected]d> wrote:
I can't load a 765MB, 7.5 million-line text file into my text editor.
It's not like I need to do that routinely. I just wanted to see if
Tcl/Tk would handle it. But my text editor crashes every time.
Then there is something else, besides Tcl/Tk "can't handle it" going on
with your text editor.
$ ls -l
total 8
-rwxr-xr-x 1 users 118 Feb 25 23:20 loadbigtext*
-rwxr-xr-x 1 users 228 Feb 25 23:17 makebigtext*
$ time ./makebigtext
real 0m13.975s
user 0m13.026s
sys 0m0.740s
$ ls -lh
total 779M
-rw-r--r-- 1 users 779M Feb 25 23:23 bigtext
-rwxr-xr-x 1 users 118 Feb 25 23:20 loadbigtext*
-rwxr-xr-x 1 users 228 Feb 25 23:17 makebigtext*
$ ./loadbigtext
8000002.0
And in about 6 seconds a text widget appears, containing all 8M lines
from the 'big file'. And I can scroll around using the mouse wheel.
Total memory used (per top) is 3007m.
Contents of "make big text":
$ cat makebigtext
#!/usr/bin/tclsh
set fd [open bigtext {WRONLY CREAT TRUNC}]
for {set i 0} {$i < 8000000} {incr i} {
puts $fd "The quick brown fox jumped over the lazy dog. Mary had a little lamb, it's fleece was white as snow."
}
close $fd
Note that the above creates an 800M line file.
Contents of "loadbigtest":
$ cat loadbigtext
#!/usr/bin/wish
text .t
pack .t
set fd [open bigtext RDONLY]
.t insert end [read $fd]
close $fd
puts [.t index end]
So, provided one has sufficient free RAM, Tcl/Tk can load an 8M line
file that is 779M large (both more lines and a larger file than your
file).
So something else is causing your crash.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)