caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] GC and C
@ 2004-01-13 17:56 Lauren A
  2004-01-13 18:34 ` Richard Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Lauren A @ 2004-01-13 17:56 UTC (permalink / raw)
  To: caml-list

I'm trying to call an already-written C function from
my OCaml code. I've written a wrapper for the C
function (in C) that calls CAMLparam on the incoming
arguments and uses CAMLreturn for the return value. 

Somewhere in the middle of my program, I get a seg
fault, which, when I use a debugger, looks like it's
coming from the garbage collector. Weirdly, when I
call Gc.compact() in my OCaml code-- either directly
before or after calling my C wrapper function-- I
don't get a seg fault and everything seems to work
properly.

Does anyone have any idea what might be going on?

Thank you very much,
Lauren


__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------
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] 6+ messages in thread

* Re: [Caml-list] GC and C
  2004-01-13 17:56 [Caml-list] GC and C Lauren A
@ 2004-01-13 18:34 ` Richard Jones
  2004-01-13 19:41   ` Kip Macy
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Jones @ 2004-01-13 18:34 UTC (permalink / raw)
  To: caml-list

On Tue, Jan 13, 2004 at 09:56:00AM -0800, Lauren A wrote:
> Does anyone have any idea what might be going on?

No, but I have a tip for you.

Add frequent calls to Gc.full_major () to your code.

If you've corrupted the memory, one of them will fail, and the stack
trace is often very informative in these cases. -- Hopefully you'll be
able to get a core dump and use gdb on it.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://freshmeat.net/users/rwmj
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
"One serious obstacle to the adoption of good programming languages is
the notion that everything has to be sacrificed for speed. In computer
languages as in life, speed kills." -- Mike Vanier

-------------------
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] 6+ messages in thread

* Re: [Caml-list] GC and C
  2004-01-13 18:34 ` Richard Jones
@ 2004-01-13 19:41   ` Kip Macy
  2004-01-13 20:27     ` malc
  0 siblings, 1 reply; 6+ messages in thread
From: Kip Macy @ 2004-01-13 19:41 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

> If you've corrupted the memory, one of them will fail, and the stack
> trace is often very informative in these cases. -- Hopefully you'll be
> able to get a core dump and use gdb on it.

Speaking of GDB, just as a quick poll, are there many people who
strongly feel that they would like to have ocaml support in GDB for
native binaries? Or am I unique?

I'm not volunteering right now, but I've done a bit of work in GDB
for work in the past. Of course ocamlopt would have generate stabs or
dwarf output, which would be contingent on the willingness of Xavier
et al. to commit it.

Thanks.


					-Kip


-------------------
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] 6+ messages in thread

* Re: [Caml-list] GC and C
  2004-01-13 19:41   ` Kip Macy
@ 2004-01-13 20:27     ` malc
  2004-01-13 21:44       ` Issac Trotts
  0 siblings, 1 reply; 6+ messages in thread
From: malc @ 2004-01-13 20:27 UTC (permalink / raw)
  To: Kip Macy; +Cc: caml-list

On Tue, 13 Jan 2004, Kip Macy wrote:

> > If you've corrupted the memory, one of them will fail, and the stack
> > trace is often very informative in these cases. -- Hopefully you'll be
> > able to get a core dump and use gdb on it.
>
> Speaking of GDB, just as a quick poll, are there many people who
> strongly feel that they would like to have ocaml support in GDB for
> native binaries? Or am I unique?

http://thebase.weblogger.com/stories/storyReader$2393

-- 
mailto:malc@pulsesoft.com

-------------------
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] 6+ messages in thread

* Re: [Caml-list] GC and C
  2004-01-13 20:27     ` malc
@ 2004-01-13 21:44       ` Issac Trotts
  2004-01-13 22:32         ` Dustin Sallings
  0 siblings, 1 reply; 6+ messages in thread
From: Issac Trotts @ 2004-01-13 21:44 UTC (permalink / raw)
  To: caml-list

On Tuesday 13 January 2004 12:27, malc wrote:
> On Tue, 13 Jan 2004, Kip Macy wrote:
> > > If you've corrupted the memory, one of them will fail, and the stack
> > > trace is often very informative in these cases. -- Hopefully you'll be
> > > able to get a core dump and use gdb on it.
> >
> > Speaking of GDB, just as a quick poll, are there many people who
> > strongly feel that they would like to have ocaml support in GDB for
> > native binaries? Or am I unique?
>
> http://thebase.weblogger.com/stories/storyReader$2393

When I click on it, it says "you are not a beautiful and unique snowflake."  
Maybe so, but what does it have to do with gdb and ocaml?

-- 
Issac Trotts


-------------------
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] 6+ messages in thread

* Re: [Caml-list] GC and C
  2004-01-13 21:44       ` Issac Trotts
@ 2004-01-13 22:32         ` Dustin Sallings
  0 siblings, 0 replies; 6+ messages in thread
From: Dustin Sallings @ 2004-01-13 22:32 UTC (permalink / raw)
  To: Issac Trotts; +Cc: caml-list


On Jan 13, 2004, at 13:44, Issac Trotts wrote:

>>> Speaking of GDB, just as a quick poll, are there many people who
>>> strongly feel that they would like to have ocaml support in GDB for
>>> native binaries? Or am I unique?
>>
>> http://thebase.weblogger.com/stories/storyReader$2393
>
> When I click on it, it says "you are not a beautiful and unique 
> snowflake."
> Maybe so, but what does it have to do with gdb and ocaml?

	I believe that was a vote for gdb support.

-- 
Dustin Sallings

-------------------
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] 6+ messages in thread

end of thread, other threads:[~2004-01-13 22:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-13 17:56 [Caml-list] GC and C Lauren A
2004-01-13 18:34 ` Richard Jones
2004-01-13 19:41   ` Kip Macy
2004-01-13 20:27     ` malc
2004-01-13 21:44       ` Issac Trotts
2004-01-13 22:32         ` Dustin Sallings

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