# Is it hard to support Julia UDFs in DuckDB?

**URL:** <https://discourse.julialang.org/t/is-it-hard-to-support-julia-udfs-in-duckdb/118509>\
**Category:** Data\
**Created:** [August 23, 2024, 12:11am UTC](https://discourse.julialang.org/t/is-it-hard-to-support-julia-udfs-in-duckdb/118509 "2024-08-23T00:11:59Z")\
**Posts on this page:** 1\
**Showing post:** 29

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [January 8, 2025, 1:32pm UTC](https://discourse.julialang.org/t/is-it-hard-to-support-julia-udfs-in-duckdb/118509/29 "2025-01-08T13:32:08Z")

</div>

Thank you for all the work on Julia support on DuckDB, I use it heavily in my work.

> [@tqml](#):
>
> **Current Issues** :  
> Memory management might be a problem. If someone uses reference types they could get garbage collected, while DuckDB still has a state pointer to it.

Maybe this might help, instead of the global dictionary?

```julia
help?> GC.@preserve
  GC.@preserve x1 x2 ... xn expr

  Mark the objects x1, x2, ... as being in use during the evaluation of the expression expr. This is only required in unsafe code where expr implicitly uses memory or other resources owned by one of the xs.

```

See for example [What am I doing wrong with `unsafe_wrap()`? - #2 by simeonschaub](https://discourse.julialang.org/t/what-am-i-doing-wrong-with-unsafe-wrap/75105/2) on how to use `@preserve` with `unsafe_wrap`. I imagine this use case should be similar?

---

_[View the full topic](https://discourse.julialang.org/t/is-it-hard-to-support-julia-udfs-in-duckdb/118509)._
