caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* What does "pc" mean in ocamldebug
@ 2008-01-30 23:45 Mathijs Romans
  2008-01-31  9:39 ` [Caml-list] " Pietro Abate
  2008-02-07 10:46 ` Damien Doligez
  0 siblings, 2 replies; 4+ messages in thread
From: Mathijs Romans @ 2008-01-30 23:45 UTC (permalink / raw)
  To: caml-list

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?

Thanks,
Mathijs


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

* Re: [Caml-list] What does "pc" mean in ocamldebug
  2008-01-30 23:45 What does "pc" mean in ocamldebug Mathijs Romans
@ 2008-01-31  9:39 ` Pietro Abate
  2008-02-07 10:46 ` Damien Doligez
  1 sibling, 0 replies; 4+ messages in thread
From: Pietro Abate @ 2008-01-31  9:39 UTC (permalink / raw)
  To: caml-list

On Thu, Jan 31, 2008 at 12:45:38AM +0100, Mathijs Romans wrote:
> 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?

just a wild guess... program counter maybe ?

p

-- 
++ 
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.gnu.org/philosophy/no-word-attachments.html


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

* Re: [Caml-list] What does "pc" mean in ocamldebug
  2008-01-30 23:45 What does "pc" mean in ocamldebug Mathijs Romans
  2008-01-31  9:39 ` [Caml-list] " Pietro Abate
@ 2008-02-07 10:46 ` Damien Doligez
  2008-02-07 11:39   ` Mathijs Romans
  1 sibling, 1 reply; 4+ messages in thread
From: Damien Doligez @ 2008-02-07 10:46 UTC (permalink / raw)
  To: caml-list; +Cc: Mathijs Romans

Hello,

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


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

* Re: [Caml-list] What does "pc" mean in ocamldebug
  2008-02-07 10:46 ` Damien Doligez
@ 2008-02-07 11:39   ` Mathijs Romans
  0 siblings, 0 replies; 4+ messages in thread
From: Mathijs Romans @ 2008-02-07 11:39 UTC (permalink / raw)
  To: Damien Doligez; +Cc: caml-list

On Thursday 07 February 2008 11:46:47 Damien Doligez wrote:
> Hello,
>
> 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
> of
> 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

Thanks for the information. You're right, the program counter has nothing to 
do with the issue. I learned that between versions 3.06 and 3.08 the rules 
for a recursive equality test have changed, and I now need to update my 
program.

Mathijs


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

end of thread, other threads:[~2008-02-07 11:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-30 23:45 What does "pc" mean in ocamldebug Mathijs Romans
2008-01-31  9:39 ` [Caml-list] " Pietro Abate
2008-02-07 10:46 ` Damien Doligez
2008-02-07 11:39   ` Mathijs Romans

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