# \#gc

**URL:** https://discourse.julialang.org/tag/gc/1436.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Sometimes cannot reclaim memory by manual GC.gc()](https://discourse.julialang.org/t/sometimes-cannot-reclaim-memory-by-manual-gc-gc/135158)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 9\
**Last updated:** [January 21, 2026, 10:09am UTC](https://discourse.julialang.org/t/sometimes-cannot-reclaim-memory-by-manual-gc-gc/135158 "2026-01-21T10:09:24Z")

</div>

Edit: Please see the #7 post directly if you’re interested. Thanks. The idea is: I at first create a Vector v = Vector{Matrix{Float64}}(undef, 100); Then I need to fill it with some concrete objects (here are matric…

---

## [Best practice for calling Julia functions via API](https://discourse.julialang.org/t/best-practice-for-calling-julia-functions-via-api/135086)

<div class="topic-metadata">

**Author:** [@Chrysoberyl](https://discourse.julialang.org/u/Chrysoberyl)\
**Replies:** 0\
**Last updated:** [January 15, 2026, 8:04pm UTC](https://discourse.julialang.org/t/best-practice-for-calling-julia-functions-via-api/135086 "2026-01-15T20:04:30Z")

</div>

In my setup, a Julia function calls a C/Rust function play(agent, environment), which spawns some threads, and call functions on agent. agent and environment are Julia objects. Each of these foreign threads gets registe…

---

## [The new Green Tea Garbage Collector in Go](https://discourse.julialang.org/t/the-new-green-tea-garbage-collector-in-go/133612)

<div class="topic-metadata">

**Author:** [@paulmelis](https://discourse.julialang.org/u/paulmelis)\
**Replies:** 1\
**Last updated:** [December 10, 2025, 11:02am UTC](https://discourse.julialang.org/t/the-new-green-tea-garbage-collector-in-go/133612 "2025-12-10T11:02:10Z")

</div>

Pretty interesting write-up of the new GC coming to the next version of Go, with the core idea being to operate on pages of objects instead of individual objects (plus lots of optimizations). Also, really cute and use…

---

## [Remove memory from Julia's management](https://discourse.julialang.org/t/remove-memory-from-julias-management/133983)

<div class="topic-metadata">

**Author:** [@Chrysoberyl](https://discourse.julialang.org/u/Chrysoberyl)\
**Replies:** 2\
**Last updated:** [November 19, 2025, 12:19pm UTC](https://discourse.julialang.org/t/remove-memory-from-julias-management/133983 "2025-11-19T12:19:01Z")

</div>

When calling into Julia and using it as a library, is it possible to remove an allocated datum from Julia’s management? My use case is this: I have a Julia function, passed across FFI as a callback, which creates data b…

---

## [Automatically enable GC during JIT compile](https://discourse.julialang.org/t/automatically-enable-gc-during-jit-compile/133894)

<div class="topic-metadata">

**Author:** [@csvance](https://discourse.julialang.org/u/csvance)\
**Replies:** 2\
**Last updated:** [November 15, 2025, 12:19am UTC](https://discourse.julialang.org/t/automatically-enable-gc-during-jit-compile/133894 "2025-11-15T00:19:39Z")

</div>

To get the best performance for my Julia RPC server in production, I turn off GC during the execution of each request and manually call the GC after returning the response. Each Julia RPC server process only handles one …

---

## [Disassociate GC time from compile time](https://discourse.julialang.org/t/disassociate-gc-time-from-compile-time/130194)

<div class="topic-metadata">

**Author:** [@theogf](https://discourse.julialang.org/u/theogf)\
**Replies:** 4\
**Last updated:** [June 26, 2025, 11:41am UTC](https://discourse.julialang.org/t/disassociate-gc-time-from-compile-time/130194 "2025-06-26T11:41:46Z")

</div>

The @timed macro provides a bunch of very interesting stats about GC and compilation time. I wanted to reuse this data to estimate the time excluding compilation and GC. However since (I believe) GC can and will happen …

---

## [Can I manage the memory by myself?](https://discourse.julialang.org/t/can-i-manage-the-memory-by-myself/97250)

<div class="topic-metadata">

**Author:** [@zhijie\_sun](https://discourse.julialang.org/u/zhijie_sun)\
**Replies:** 16\
**Last updated:** [February 1, 2025, 7:03pm UTC](https://discourse.julialang.org/t/can-i-manage-the-memory-by-myself/97250 "2025-02-01T19:03:19Z")

</div>

I have a code, the GC live and RSS memory increased quickly when running, while I don’t need such big memory to do basic computation. I need to allocate lots of small dict for intermidiate computing before, and the memor…

---

## [Using environment variables to moderate GC. julia version 1.10.4 with prerelease version](https://discourse.julialang.org/t/using-environment-variables-to-moderate-gc-julia-version-1-10-4-with-prerelease-version/118483)

<div class="topic-metadata">

**Author:** [@hapopo](https://discourse.julialang.org/u/hapopo)\
**Replies:** 1\
**Last updated:** [August 22, 2024, 4:50pm UTC](https://discourse.julialang.org/t/using-environment-variables-to-moderate-gc-julia-version-1-10-4-with-prerelease-version/118483 "2024-08-22T16:50:55Z")

</div>

Hello, i am new to julia and using it for numerical simulations. i use a very RAM heavy code that generates multiple dictionaries with a lot of entries. I use Threads.@threads in this code using 60 workers (i have 64 log…

---

## [Objects not being finalized until exit() when using multithreading. Is this a bug?](https://discourse.julialang.org/t/objects-not-being-finalized-until-exit-when-using-multithreading-is-this-a-bug/117595)

<div class="topic-metadata">

**Author:** [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Replies:** 2\
**Last updated:** [July 29, 2024, 4:17pm UTC](https://discourse.julialang.org/t/objects-not-being-finalized-until-exit-when-using-multithreading-is-this-a-bug/117595 "2024-07-29T16:17:21Z")

</div>

Here’s a script which defines a mutable struct Foo, creates 10 of them, loops over them using Threads.@threads and then calls GC: mutable struct Foo value::Int function Foo(value) finalizer(new(value)) d…

---

## [Case study: Real time hardware control for adaptive optics with Julia](https://discourse.julialang.org/t/case-study-real-time-hardware-control-for-adaptive-optics-with-julia/117155)

<div class="topic-metadata">

**Author:** [@sefffal](https://discourse.julialang.org/u/sefffal)\
**Replies:** 9\
**Last updated:** [July 23, 2024, 3:29pm UTC](https://discourse.julialang.org/t/case-study-real-time-hardware-control-for-adaptive-optics-with-julia/117155 "2024-07-23T15:29:10Z")

</div>

\[not sure this is the best category, mods feel free to move\] Hi all, I wanted to share our recent conference proceeding on using Julia in a real time application: \[2407.07207\] Real-time adaptive optics control with a h…

---

## [C struct garbage collection not run frequently enough](https://discourse.julialang.org/t/c-struct-garbage-collection-not-run-frequently-enough/116919)

<div class="topic-metadata">

**Author:** [@mattsignorelli](https://discourse.julialang.org/u/mattsignorelli)\
**Replies:** 28\
**Last updated:** [July 14, 2024, 11:42pm UTC](https://discourse.julialang.org/t/c-struct-garbage-collection-not-run-frequently-enough/116919 "2024-07-14T23:42:04Z")

</div>

I have a Julia interface to a C library where each C struct represents a number. In Julia, the mutable struct just contains a Ptr to the C struct, and the finalizer calls the C destructor. These C structs can be very me…

---

## [What do allocations (triggering GC) depend on?](https://discourse.julialang.org/t/what-do-allocations-triggering-gc-depend-on/114202)

<div class="topic-metadata">

**Author:** [@Thomas008](https://discourse.julialang.org/u/Thomas008)\
**Replies:** 1\
**Last updated:** [May 13, 2024, 4:28pm UTC](https://discourse.julialang.org/t/what-do-allocations-triggering-gc-depend-on/114202 "2024-05-13T16:28:18Z")

</div>

I want to compile code with help of StaticCompiler. So I need to avoid GC allocations. I want to understand when GC allocations occur. In the following code 3 GC allocations happen: using StaticTools mutable struct D …

---

## [Memory usage blow up on julia 1.9](https://discourse.julialang.org/t/memory-usage-blow-up-on-julia-1-9/103869)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 5\
**Last updated:** [March 29, 2024, 10:32am UTC](https://discourse.julialang.org/t/memory-usage-blow-up-on-julia-1-9/103869 "2024-03-29T10:32:10Z")

</div>

Our in-house application has been seeing huge memory usage spikes since our upgrade to 1.9 (5x what was used before). Has anyone else experienced that? The new feature is a likely culprit, but we’re still early in our in…

---

## [Should I use multiple threads for parallel GC with otherwise sequential code?](https://discourse.julialang.org/t/should-i-use-multiple-threads-for-parallel-gc-with-otherwise-sequential-code/109719)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 1\
**Last updated:** [February 5, 2024, 12:51am UTC](https://discourse.julialang.org/t/should-i-use-multiple-threads-for-parallel-gc-with-otherwise-sequential-code/109719 "2024-02-05T00:51:10Z")

</div>

As Julia v10 has added parallel GC, is it advisable to use multiple threads with the -t command line option of julia even if the code to be run is non-parallel? Is there any possible performance regression compared with …

---

## [Best strategy to choose the number of gc threads on a cluster](https://discourse.julialang.org/t/best-strategy-to-choose-the-number-of-gc-threads-on-a-cluster/107596)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 2\
**Last updated:** [December 14, 2023, 9:45am UTC](https://discourse.julialang.org/t/best-strategy-to-choose-the-number-of-gc-threads-on-a-cluster/107596 "2023-12-14T09:45:04Z")

</div>

I have a multithreaded code that I am running on a cluster using Julia v1.10, and it allocates many temporary arrays. The computation is quite linear algebra heavy, and I would like to keep freeing memory from time to ti…
