caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: Still strange GC problems with OCaml and C: OCaml 2.04 bug?
@ 2000-02-21 18:29 Manuel Fahndrich
  0 siblings, 0 replies; 3+ messages in thread
From: Manuel Fahndrich @ 2000-02-21 18:29 UTC (permalink / raw)
  To: 'David.Mentre@irisa.fr', caml-redistribution; +Cc: colcombe


I'm not suggesting that your problem is the same as the one described here
http://pauillac.inria.fr/caml/caml-list/1415.html, but it's always a
scenario to keep in mind.

-Manuel


-----Original Message-----
From: David.Mentre@irisa.fr [mailto:David.Mentre@irisa.fr]
Sent: Monday, February 21, 2000 9:18 AM
To: caml-redistribution@pauillac.inria.fr
Cc: colcombe@irisa.fr
Subject: Still strange GC problems with OCaml and C: OCaml 2.04 bug?


Hi all Camlists,

I'm still fighting against my bug while trying to interface OCaml with
CMU bdd library (in C).

Following Xavier comments, I've protected my values (with CAMLparamXX
and CAMLlocalXX macros). 

Actual code is available at:
  http://www.irisa.fr/paris/pages-perso/David-Mentre/bdd.ml
  http://www.irisa.fr/paris/pages-perso/David-Mentre/bdd_interface.c

 1. I still obtain a segfault, however, the gdb backtrace has changed:
(gdb) bt
#0  0x80655b5 in mark_slice ()
#1  0x80659eb in major_collection_slice ()
#2  0x8065fd3 in minor_collection ()
#3  0x8063859 in interprete ()
#4  0x8065043 in caml_main ()
#5  0x805ab45 in main ()
#6  0x2ab457e2 in __libc_start_main () from /lib/libc.so.6

    It is still a GC bug, however the problem no longer arises while our
    C interface allocates CAML memory. So I think the bug has moved (or
    this is another bug).

 2. More interestingly, by compiling this code with OCaml 2.99 under
    sun4 architecture, this bug no longer occurs. I obtain in place a:

Fatal error: uncaught exception Invalid_argument("Array.get")

    So, it would be possible that some Invalid_argument exceptions are
    not properly caught in OCaml 2.04.

    For CAML team, I was not able to produce a small/simple example that
    can trigger this bug. Only my gas-plant program seems to
    segfault. Sorry.

 3. I've found an interesting message on Damien Doliguez site[1]:

http://pauillac.inria.fr/~doligez/caml-guts/Fahndrich99.txt

    This message tells that you can have strange CAML GC related
    problems while deallocating C structures. However, I think my code
    is in case 2 of Manuel proposed fixes (i.e. box every C pointer
    inside an abstract CAML block). So, in my opinion, my bug is not
    related to this problem. But, as am I paranoid now :), I've set
    pointers to 1 after deallocating them. This not fixed the bug.


Anyway, if somebody has an advice on how to track down this bug, I'll
glady accept it.


David -- once happy in the Caml-only world


[1]http://pauillac.inria.fr/~doligez/caml-guts/
-- 
 David.Mentre@irisa.fr -- http://www.irisa.fr/prive/dmentre/
 Opinions expressed here are only mine.



^ permalink raw reply	[flat|nested] 3+ messages in thread
* Still strange GC problems with OCaml and C: OCaml 2.04 bug?
@ 2000-02-21 14:09 David Mentré
  2000-02-21 20:10 ` Markus Mottl
  0 siblings, 1 reply; 3+ messages in thread
From: David Mentré @ 2000-02-21 14:09 UTC (permalink / raw)
  To: caml-list; +Cc: colcombe

Hi all Camlists,

I'm still fighting against my bug while trying to interface OCaml with
CMU bdd library (in C).

Following Xavier comments, I've protected my values (with CAMLparamXX
and CAMLlocalXX macros). 

Actual code is available at:
  http://www.irisa.fr/paris/pages-perso/David-Mentre/bdd.ml
  http://www.irisa.fr/paris/pages-perso/David-Mentre/bdd_interface.c

 1. I still obtain a segfault, however, the gdb backtrace has changed:
(gdb) bt
#0  0x80655b5 in mark_slice ()
#1  0x80659eb in major_collection_slice ()
#2  0x8065fd3 in minor_collection ()
#3  0x8063859 in interprete ()
#4  0x8065043 in caml_main ()
#5  0x805ab45 in main ()
#6  0x2ab457e2 in __libc_start_main () from /lib/libc.so.6

    It is still a GC bug, however the problem no longer arises while our
    C interface allocates CAML memory. So I think the bug has moved (or
    this is another bug).

 2. More interestingly, by compiling this code with OCaml 2.99 under
    sun4 architecture, this bug no longer occurs. I obtain in place a:

Fatal error: uncaught exception Invalid_argument("Array.get")

    So, it would be possible that some Invalid_argument exceptions are
    not properly caught in OCaml 2.04.

    For CAML team, I was not able to produce a small/simple example that
    can trigger this bug. Only my gas-plant program seems to
    segfault. Sorry.

 3. I've found an interesting message on Damien Doliguez site[1]:

http://pauillac.inria.fr/~doligez/caml-guts/Fahndrich99.txt

    This message tells that you can have strange CAML GC related
    problems while deallocating C structures. However, I think my code
    is in case 2 of Manuel proposed fixes (i.e. box every C pointer
    inside an abstract CAML block). So, in my opinion, my bug is not
    related to this problem. But, as am I paranoid now :), I've set
    pointers to 1 after deallocating them. This not fixed the bug.


Anyway, if somebody has an advice on how to track down this bug, I'll
glady accept it.


David -- once happy in the Caml-only world


[1]http://pauillac.inria.fr/~doligez/caml-guts/
-- 
 David.Mentre@irisa.fr -- http://www.irisa.fr/prive/dmentre/
 Opinions expressed here are only mine.



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

end of thread, other threads:[~2000-02-22 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-21 18:29 Still strange GC problems with OCaml and C: OCaml 2.04 bug? Manuel Fahndrich
  -- strict thread matches above, loose matches on Subject: below --
2000-02-21 14:09 David Mentré
2000-02-21 20:10 ` Markus Mottl

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