If you create objects from C you need to be very careful to have
appropriate gc roots, for all values involved before yielding control
back to julia.

On Tue, Aug 9, 2016 at 6:23 PM,  <[email protected]> wrote:
> I'm contributing a bit to rjulia and I've run into some trouble creating
> julia DataFrames from C in 0.5 (rc 1+1)
>
> Creating a DataFrame from C like this:
>
> jl_value_t *ans = jl_eval_string("DataFrame( Any[ 1:4, 5:8 ], [:a,:b] )");
>
> worked in 0.4 as did
>
> jl_function_t *func = jl_get_function(jl_main_module, "DataFrame");
> jl_value_t *ans = jl_call2(func, (jl_value_t *)col_list, (jl_value_t
> *)col_names);
>
> assuming the DataFrames package had been loaded.  col_list is an
> Array{Any,1} and col_names is an Array{Symbol,1}.
>
> In 0.5 rc 1+1 with DataFrames 0.7.7,
>
> I get a very verbose error message:
>
> signal (11): Segmentation fault: 11
>  while loading no file, in expression starting on line 0
>  gc_mark_stack at
> /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gc.c:1239 [inlined]
>  gc_mark_task_stack at
> /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gc.c:1275 [inlined]
>  gc_mark_task at
> /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gc.c:1298
>  push_root at
> /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gc.c:1426
>  gc_push_root at
> /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gc.c:1179 [inlined]
>  gc_mark_module at
> /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gc.c:1208
>  push_root at
> /Users/osx/buildbot/slave/package_osx10_9-x64/build/src/gc.c:1419
> ...
>
> As a positive control,
>
> jl_value_t *ans = jl_eval_string("DataFrame()");
>
> works in both 0.4 and 0.5.
>
> Can anyone think of something that changed that might cause such a problem?
> The "OutOfMemory" bug in 0.5 rc0 caused some similar trouble, so I'm hoping
> that another (soon to be fixed) issue in 0.5 may be responsible

Reply via email to