caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] strange behaviors with output
@ 2002-12-23  1:11 Yang Shouxun
  2002-12-23  2:27 ` Yang Shouxun
  2002-12-26 12:45 ` [Caml-list] " Michaël Grünewald
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Shouxun @ 2002-12-23  1:11 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] strange behaviors with output
  2002-12-23  1:11 [Caml-list] strange behaviors with output Yang Shouxun
@ 2002-12-23  2:27 ` Yang Shouxun
  2002-12-26 12:45 ` [Caml-list] " Michaël Grünewald
  1 sibling, 0 replies; 3+ messages in thread
From: Yang Shouxun @ 2002-12-23  2:27 UTC (permalink / raw)
  To: caml-list

Sorry, I find the problem. I forgot to set flag. 

Sorry for the noise.

-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] Re: strange behaviors with output
  2002-12-23  1:11 [Caml-list] strange behaviors with output Yang Shouxun
  2002-12-23  2:27 ` Yang Shouxun
@ 2002-12-26 12:45 ` Michaël Grünewald
  1 sibling, 0 replies; 3+ messages in thread
From: Michaël Grünewald @ 2002-12-26 12:45 UTC (permalink / raw)
  To: caml-list

Yang Shouxun <yangsx@fltrp.com> writes:

> 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<----

Your output sample is not very cute, it might have been

>For instance, if 
> the expected output should be:
> ----8<----
> GOOD
> ----8<----
> What I get may be:
> ----8<----
> BAD
> ----8<----

posting your code might be (more) helpful.
-- 
Michaël Grünewald <michael-grunewald@wanadoo.fr>  - RSA PGP Key ID: 0x20D90C12
-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-26 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-23  1:11 [Caml-list] strange behaviors with output Yang Shouxun
2002-12-23  2:27 ` Yang Shouxun
2002-12-26 12:45 ` [Caml-list] " Michaël Grünewald

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).