Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
What does "pc" mean in ocamldebug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-07 (10:46)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] What does "pc" mean in ocamldebug

On 2008-01-31, at 00:45, Mathijs Romans wrote:

> Hi!
> I am trying to make a Caml-application run that I have not written  
> myself. I
> know very little about the language itself. Sadly, I get this error:
> Fatal error: exception Out_of_memory
> Using ocamldebugger I am trying to figure out what happened. The  
> last line
> before failure is:
> Time : 36381 - pc : 65532 - module Parser
> 157     <|b|>if !current.son = !current then
> What caught my attention is that the number after "pc" is almost  
> 2^16, which
> is probably the cause of my problem. I cannot find anywhere in the
> documentation what "pc" means, nor how I can increase its maximum  
> value. Can
> somebody help me?

pc is the value of the program counter, i.e. the index of the current
byte-code instruction.  It is absolutely not limited to 2^16, and
I am quite sure its value has nothing to do with the bug you are
looking for.

Apparently, you're getting an Out_of_memory exception in the execution  
the equality test.  Since equality is recursive, it has to go through
both data structures and if they are cyclic it may not terminate.
If they are cyclic and have enough complexity, it will recursively
call itself until its stack overflows, which is reported as an
Out_of_memory exception.

The workaround is to avoid comparing cyclic data structures.

-- Damien