Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] strange behaviors with output
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yang Shouxun <yangsx@f...>
Subject: [Caml-list] strange behaviors with output
Hi,

I found a strange behavior when compiling and running a simple ocaml program.  
When the file to process (a testing case) is small, it works as expected. But 
when the file (the real case) is very large, it does not. For instance, if 
the expected output should be:
----8<----
a
b
c
d
...
----8<----
What I get may be:
----8<----
a
d
c
b
...
----8<----

That is to say, when the input file is large, every now and then the output 
sequences of lines will be reversed.

Another point is that the program consumes a lot of memory, so much so that 
when the input file is very big the progam gets killed by the OS. Actually 
the program should consume very small memory. 

What I'm trying to do is:
----8<----
initialize result
read one line from the input file 
comparing it to the last line
if test condition true
  update result
  read next line
else 
  print the result and flush stdout
----8<----

I'm using ocaml on Debian. It's the latest from sid.
Any ideas?

TIA!
shouxun
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners