Bill et al,
Please see the attached patch. I was loading a large binary library,
that in turn loads a bunch of other large libraries, some of which
binary, some of which scheme. I was getting a bunch of segfaults and
strange behavior
Adding some gc_protect calls seems to have fixed the issue. Does the
patch i've attached make sense?
Thanks,
Woody Douglass
Software Engineer
Carnegie Robotics LLC
Index: s7-master-3ec4a66f3582631c4fa242f0d922a7122cd715f8/s7.c
===================================================================
--- s7-master-3ec4a66f3582631c4fa242f0d922a7122cd715f8.orig/s7.c
+++ s7-master-3ec4a66f3582631c4fa242f0d922a7122cd715f8/s7.c
@@ -30092,6 +30092,7 @@ static s7_pointer load_shared_object(s7_
{
s7_pointer init;
init = s7_let_ref(sc, let, make_symbol(sc, "init_func"));
+ s7_gc_protect_via_stack(sc, init);
if (!is_symbol(init))
s7_warn(sc, 512, "can't load %s: no init function\n", fname);
else
@@ -30111,8 +30112,12 @@ static s7_pointer load_shared_object(s7_
s7_pointer init_args, p;
init_args = s7_let_ref(sc, let, make_symbol(sc, "init_args"));
- if (is_pair(init_args))
+ s7_gc_protect_via_stack(sc, init_args);
+ if (is_pair(init_args)) {
p = ((dl_func_with_args)init_func)(sc, init_args);
+
+ s7_gc_protect_via_stack(sc, p);
+ }
/* if caller includes init_args, but init_func is actually a dl_func, it seems to be ok,
* but the returned value is whatever was last computed in the init_func.
*/
_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist