# \#memory

**URL:** https://discourse.julialang.org/tag/memory/158.md

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

---

## [Compiler mis-recognizes contiguous reinterpreted matrices?](https://discourse.julialang.org/t/compiler-mis-recognizes-contiguous-reinterpreted-matrices/138979)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 11\
**Last updated:** [August 25, 2026, 2:02pm UTC](https://discourse.julialang.org/t/compiler-mis-recognizes-contiguous-reinterpreted-matrices/138979 "2026-08-25T14:02:33Z")

</div>

I am implementing an ODE to use with OrdinaryDiffEq. I am simultaneously evolving in time multiple quantities, which are combinations of vectors and matrices, some real and some complex. The approach I took has been to g…

---

## [Yet another question about Julia's high RAM usage](https://discourse.julialang.org/t/yet-another-question-about-julias-high-ram-usage/130693)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 26\
**Last updated:** [July 24, 2026, 5:44pm UTC](https://discourse.julialang.org/t/yet-another-question-about-julias-high-ram-usage/130693 "2026-07-24T17:44:29Z")

</div>

Summary of my current understanding: Julia has a relatively high memory footprint for an interactive language for various reasons: 1) an OpenBLAS implementation that preallocates buffers to accelerate matrix multiplicati…

---

## [Memory blow-up when solving a sparse affine Hermitian SDP translated from YALMIP to JuMP](https://discourse.julialang.org/t/memory-blow-up-when-solving-a-sparse-affine-hermitian-sdp-translated-from-yalmip-to-jump/137744)

<div class="topic-metadata">

**Author:** [@hz-xiaxz](https://discourse.julialang.org/u/hz-xiaxz)\
**Replies:** 10\
**Last updated:** [June 23, 2026, 7:24am UTC](https://discourse.julialang.org/t/memory-blow-up-when-solving-a-sparse-affine-hermitian-sdp-translated-from-yalmip-to-jump/137744 "2026-06-23T07:24:42Z")

</div>

Hi JuMP developers, I am translating a MATLAB/YALMIP semidefinite program to Julia/JuMP + MosekTools. The model comes from a many-body bootstrap calculation. The MATLAB/YALMIP version can solve a small 3 x 3 lattice cas…

---

## [Equivalent of numpy.tobytes and numpy.frombuffer in Julia](https://discourse.julialang.org/t/equivalent-of-numpy-tobytes-and-numpy-frombuffer-in-julia/136554)

<div class="topic-metadata">

**Author:** [@lilachint](https://discourse.julialang.org/u/lilachint)\
**Replies:** 4\
**Last updated:** [April 4, 2026, 4:05pm UTC](https://discourse.julialang.org/t/equivalent-of-numpy-tobytes-and-numpy-frombuffer-in-julia/136554 "2026-04-04T16:05:48Z")

</div>

Hi! As the topic stated, I once built a Python package that uses numpy.tobytes (source) and numpy.frombuffer (source) when caching things with SQLite. In Julia, I want to do this with BitArrays instead to save even more…

---

## [Sysimage creation process gets OOM killed (out-of-memory)](https://discourse.julialang.org/t/sysimage-creation-process-gets-oom-killed-out-of-memory/136079)

<div class="topic-metadata">

**Author:** [@Abhro](https://discourse.julialang.org/u/Abhro)\
**Replies:** 3\
**Last updated:** [March 7, 2026, 3:15pm UTC](https://discourse.julialang.org/t/sysimage-creation-process-gets-oom-killed-out-of-memory/136079 "2026-03-07T15:15:40Z")

</div>

When I try to create a sysimage with Makie in it (or maybe any other heavy package, Makie’s the only one I’ve noticed), the create\_sysimage() call gets to the “Compiling incremental sysimage” stage, then crashes, also ex…

---

## [High memory usage when creating lots of temporary C++ objects](https://discourse.julialang.org/t/high-memory-usage-when-creating-lots-of-temporary-c-objects/135399)

<div class="topic-metadata">

**Author:** [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Replies:** 9\
**Last updated:** [February 3, 2026, 3:51pm UTC](https://discourse.julialang.org/t/high-memory-usage-when-creating-lots-of-temporary-c-objects/135399 "2026-02-03T15:51:45Z")

</div>

I found out that creating lots of temporary C++ objects through CxxWrap takes a lot of memory (duh!) and does not return that memory to the system after GC. My use case is this package wrapping Voro++ library. Logically…

---

## [What is the correct way to use Base.OncePerThread?](https://discourse.julialang.org/t/what-is-the-correct-way-to-use-base-onceperthread/134597)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 7\
**Last updated:** [December 18, 2025, 4:52pm UTC](https://discourse.julialang.org/t/what-is-the-correct-way-to-use-base-onceperthread/134597 "2025-12-18T16:52:42Z")

</div>

I want to use Base.OncePerThread but it’s not clear what the intended usage is. Is the following a correct / safe / intended way to use Base.OncePerThread ? finalset = Set() tempsets = OncePerThread() do return Set…

---

## [How to cleanup artifacts folder](https://discourse.julialang.org/t/how-to-cleanup-artifacts-folder/101277)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 7\
**Last updated:** [December 14, 2025, 7:00pm UTC](https://discourse.julialang.org/t/how-to-cleanup-artifacts-folder/101277 "2025-12-14T19:00:05Z")

</div>

I recently noticed that my home folder is occupying 89% of my SSD because of .julia/artifacts: How to clean up this folder and start fresh? I just want to keep the global environments I’ve defined and the dev’ed pack…

---

## [Understanding memory usage in Julia](https://discourse.julialang.org/t/understanding-memory-usage-in-julia/101647)

<div class="topic-metadata">

**Author:** [@Andrea\_Vigliotti](https://discourse.julialang.org/u/Andrea_Vigliotti)\
**Replies:** 23\
**Last updated:** [December 12, 2025, 4:30pm UTC](https://discourse.julialang.org/t/understanding-memory-usage-in-julia/101647 "2025-12-12T16:30:39Z")

</div>

I am working on a finite element program that solves a non linear problem by incrementing the boundary conditions, that means that from time to time I need to assemble some quite large stiffness matrices (\\approx 350k \\t…

---

## [GPU memory issue on AMDGPU](https://discourse.julialang.org/t/gpu-memory-issue-on-amdgpu/133560)

<div class="topic-metadata">

**Author:** [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Replies:** 4\
**Last updated:** [November 10, 2025, 7:51am UTC](https://discourse.julialang.org/t/gpu-memory-issue-on-amdgpu/133560 "2025-11-10T07:51:57Z")

</div>

I am trying to train a neural network and make inference using this neural network with Lux (1.22.1) AMDGPU (2.1.1) and julia (1.12.0). The AMDGPU version kernel driver is 6.3.6 (as reported by /sys/module/amdgpu/versio…

---

## [Fully Unique Combinations from Multiple Arrays](https://discourse.julialang.org/t/fully-unique-combinations-from-multiple-arrays/133626)

<div class="topic-metadata">

**Author:** [@wes648](https://discourse.julialang.org/u/wes648)\
**Replies:** 15\
**Last updated:** [November 5, 2025, 5:57pm UTC](https://discourse.julialang.org/t/fully-unique-combinations-from-multiple-arrays/133626 "2025-11-05T17:57:19Z")

</div>

Hello! I have a model with n terms and the ability to remove k of them. However each of the k removal options can only act on an arbitrary list of model terms. I want a memory-efficient way to generate every unique comb…

---

## [Pointers in Julia documentation](https://discourse.julialang.org/t/pointers-in-julia-documentation/119571)

<div class="topic-metadata">

**Author:** [@martin\_sanchez](https://discourse.julialang.org/u/martin_sanchez)\
**Replies:** 12\
**Last updated:** [October 29, 2025, 3:23pm UTC](https://discourse.julialang.org/t/pointers-in-julia-documentation/119571 "2025-10-29T15:23:58Z")

</div>

Hi, I was trying to implement some algorithms and data structures such as linked list, for which I need pointers. I wanted to know why is the use of pointers so obscured. I have not really found any formal explanation of…

---

## [Memory leaks from compiled functions: Solved](https://discourse.julialang.org/t/memory-leaks-from-compiled-functions-solved/130886)

<div class="topic-metadata">

**Author:** [@Gesee](https://discourse.julialang.org/u/Gesee)\
**Replies:** 18\
**Last updated:** [July 22, 2025, 4:45pm UTC](https://discourse.julialang.org/t/memory-leaks-from-compiled-functions-solved/130886 "2025-07-22T16:45:06Z")

</div>

I have been told about one known issue with Julia, compiled function doesn’t get garbage collected. So since I wanted to dynamically create functions for objects in my game engine, it was a big problem and I had to solve…

---

## [How best to preallocate memory for repeated use](https://discourse.julialang.org/t/how-best-to-preallocate-memory-for-repeated-use/130814)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 5\
**Last updated:** [July 22, 2025, 4:21pm UTC](https://discourse.julialang.org/t/how-best-to-preallocate-memory-for-repeated-use/130814 "2025-07-22T16:21:41Z")

</div>

Hello, I’m trying to reduce memory allocations. The pattern is simple: I need to redo a similar problem that requires a fair bit of memory many times. So I’m preallocating sufficient memory for the largest problem and…

---

## [Killed VS OutOfMemoryError()](https://discourse.julialang.org/t/killed-vs-outofmemoryerror/129716)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 2\
**Last updated:** [June 7, 2025, 1:55am UTC](https://discourse.julialang.org/t/killed-vs-outofmemoryerror/129716 "2025-06-07T01:55:55Z")

</div>

Why we have two different error messages? What is the difference between Killed and OutOfMemoryError() messages? julia\> A = fill(2, 5000000000) ERROR: OutOfMemoryError() slightly lower: julia\> A = fill(2, 4000000000) K…

---

## [Memory Comprehensions](https://discourse.julialang.org/t/memory-comprehensions/129033)

<div class="topic-metadata">

**Author:** [@PatrickHaecker](https://discourse.julialang.org/u/PatrickHaecker)\
**Replies:** 7\
**Last updated:** [May 25, 2025, 10:51am UTC](https://discourse.julialang.org/t/memory-comprehensions/129033 "2025-05-25T10:51:04Z")

</div>

Is there a Memory comprehension in Julia, which I missed so far? We have Array comprehensions, but when you don’t need the multiple dimensions and resizing properties of an Array and a Memory is enough, it would be nice…

---

## [Out of memory error in \`viz\` of 3D \`RectilinearGrid\` from Meshes.jl](https://discourse.julialang.org/t/out-of-memory-error-in-viz-of-3d-rectilineargrid-from-meshes-jl/128643)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 33\
**Last updated:** [May 31, 2025, 7:30pm UTC](https://discourse.julialang.org/t/out-of-memory-error-in-viz-of-3d-rectilineargrid-from-meshes-jl/128643 "2025-05-31T19:30:03Z")

</div>

I want to plot a grid using Meshes.jl and GLMakie.jl. I am reading the HDF5 data file output of Athena++ astrophysical code using HDF5.jl library. In Athena++ mesh grid is divided into smaller parts called Blocks to use…

---

## [ERROR: OutOfMemoryError()](https://discourse.julialang.org/t/error-outofmemoryerror/129229)

<div class="topic-metadata">

**Author:** [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Replies:** 10\
**Last updated:** [May 21, 2025, 9:44pm UTC](https://discourse.julialang.org/t/error-outofmemoryerror/129229 "2025-05-21T21:44:37Z")

</div>

I got ERROR: OutOfMemoryError() while running this code. How can i mitigate it? Here 872 is number of mesh blocks of whose coordinates are x, y and z. x = rand(16,872); y = rand(4,872); z = rand(18,872); r = reshape(x,…

---

## [Memory usage discrepancy](https://discourse.julialang.org/t/memory-usage-discrepancy/126085)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 8\
**Last updated:** [February 20, 2025, 5:06pm UTC](https://discourse.julialang.org/t/memory-usage-discrepancy/126085 "2025-02-20T17:06:58Z")

</div>

I have an application running in Julia. Using htop I can see that the process consumes 2 GB of memory, but if I use summarysize of all symbols in Main I just get around 150 MB in total. How can this be? I’m using Julia…

---

## [Copy on write?](https://discourse.julialang.org/t/copy-on-write/126021)

<div class="topic-metadata">

**Author:** [@iago-lito](https://discourse.julialang.org/u/iago-lito)\
**Replies:** 2\
**Last updated:** [February 18, 2025, 5:19pm UTC](https://discourse.julialang.org/t/copy-on-write/126021 "2025-02-18T17:19:17Z")

</div>

Hello Julia, I need copy-on-write behaviour to protect fields of the large values I’m handing out to my users from cluttering their memory with useless copies. Is there such thing as a julia Cow{T} akin to rust’s Cow\<T\>…

---

## [Don't understand why code runs out of memory and crashes](https://discourse.julialang.org/t/dont-understand-why-code-runs-out-of-memory-and-crashes/123559)

<div class="topic-metadata">

**Author:** [@Davide98888](https://discourse.julialang.org/u/Davide98888)\
**Replies:** 29\
**Last updated:** [December 27, 2024, 9:42pm UTC](https://discourse.julialang.org/t/dont-understand-why-code-runs-out-of-memory-and-crashes/123559 "2024-12-27T21:42:15Z")

</div>

Hello all We are having a fantastic experience with Julia, but then had a confusing experience. I am doing a simulation study, multithreaded, and eventually Julia runs out of memory and crashes. This happens especially …

---

## [Why Base.summarysize show pointers twice?](https://discourse.julialang.org/t/why-base-summarysize-show-pointers-twice/123887)

<div class="topic-metadata">

**Author:** [@garazha-ilya](https://discourse.julialang.org/u/garazha-ilya)\
**Replies:** 1\
**Last updated:** [December 16, 2024, 4:23pm UTC](https://discourse.julialang.org/t/why-base-summarysize-show-pointers-twice/123887 "2024-12-16T16:23:21Z")

</div>

Suppose I have string “Moscow”: julia\> Moscow = "Moscow" "Moscow" julia\> sizeof(Moscow) 6 julia\> Base.summarysize(Moscow) 14 I suppose, that 14 = (Pointer to Array of Chars (8 bytes)) + (6 data bytes). However, when I…

---

## [Reusing a complex FFT array’s memory as a real array, “C-style”](https://discourse.julialang.org/t/reusing-a-complex-fft-array-s-memory-as-a-real-array-c-style/120849)

<div class="topic-metadata">

**Author:** [@lmtzx9h4qqnt](https://discourse.julialang.org/u/lmtzx9h4qqnt)\
**Replies:** 7\
**Last updated:** [October 4, 2024, 1:50pm UTC](https://discourse.julialang.org/t/reusing-a-complex-fft-array-s-memory-as-a-real-array-c-style/120849 "2024-10-04T13:50:28Z")

</div>

When doing a complex-to-real FFT (using FFTW.jl), the real input and complex output arrays take roughly the same amount of memory. To quote from the rfft() docstring, If A has size (n\_1, …, n\_d), the result has size (n…

---

## [Unclear allocations with in-place mutating functions](https://discourse.julialang.org/t/unclear-allocations-with-in-place-mutating-functions/119896)

<div class="topic-metadata">

**Author:** [@fmor](https://discourse.julialang.org/u/fmor)\
**Replies:** 14\
**Last updated:** [September 26, 2024, 6:50pm UTC](https://discourse.julialang.org/t/unclear-allocations-with-in-place-mutating-functions/119896 "2024-09-26T18:50:48Z")

</div>

I am fitting a statistical model and I refactored the code to reduce the allocations it generated. I morally halved them, with respect to the first version, but there are still some unclear sections which I see from runn…

---

## [A lot of memory only loading modules!](https://discourse.julialang.org/t/a-lot-of-memory-only-loading-modules/119295)

<div class="topic-metadata">

**Author:** [@Ronneesley](https://discourse.julialang.org/u/Ronneesley)\
**Replies:** 8\
**Last updated:** [September 14, 2024, 4:35am UTC](https://discourse.julialang.org/t/a-lot-of-memory-only-loading-modules/119295 "2024-09-14T04:35:03Z")

</div>

Hi, I’m study why my modules requires a lot of memory \> 500MB. So I decided to study the growth of memory of my modules. I discovered that only one module using LibPQ let Julia use 213,1 MB. If I compare only Julia RE…

---

## [Memory usage of binaries from juliac compiler?](https://discourse.julialang.org/t/memory-usage-of-binaries-from-juliac-compiler/116918)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 3\
**Last updated:** [July 17, 2024, 8:19am UTC](https://discourse.julialang.org/t/memory-usage-of-binaries-from-juliac-compiler/116918 "2024-07-17T08:19:15Z")

</div>

There has been a JuliaCon talk about generating small binaries with juliac: This brings down the binary size, but does it bring down the startup RAM usage? It’s currently more than 200 MB on Linux.

---

## [How to delete a variable from memory in Julia?](https://discourse.julialang.org/t/how-to-delete-a-variable-from-memory-in-julia/115649)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 12\
**Last updated:** [June 17, 2024, 8:26am UTC](https://discourse.julialang.org/t/how-to-delete-a-variable-from-memory-in-julia/115649 "2024-06-17T08:26:58Z")

</div>

Below is a very memory and performance intensive part of my code which aims to a system of non-linear equations via tensor contractions. Performance and memory intensive codefunction calculate\_residual\_memeff(T2) # …

---

## [Vale's generational references memory management and Higher RAII vs Julia and other languages](https://discourse.julialang.org/t/vales-generational-references-memory-management-and-higher-raii-vs-julia-and-other-languages/114457)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [May 19, 2024, 5:27pm UTC](https://discourse.julialang.org/t/vales-generational-references-memory-management-and-higher-raii-vs-julia-and-other-languages/114457 "2024-05-19T17:27:14Z")

</div>

Vale is a very interesting language, and what can Julia learn from it? Julia could (should?) add a. Higher RAII (i.e. linear structs), i.e. new syntax and semantics (I think hope in a non-breaking way), and b. its gener…

---

## [Custom reshape() function for specific usage](https://discourse.julialang.org/t/custom-reshape-function-for-specific-usage/113382)

<div class="topic-metadata">

**Author:** [@Harrykjg-physics](https://discourse.julialang.org/u/Harrykjg-physics)\
**Replies:** 3\
**Last updated:** [April 25, 2024, 9:14am UTC](https://discourse.julialang.org/t/custom-reshape-function-for-specific-usage/113382 "2024-04-25T09:14:10Z")

</div>

Hi there ! Is there any way to minimize the memory usage of the following custom function graded\_reshape() ( Or even achieve the same performance as the Julia reshape function ) ? Suppose we have a usual Julia reshape…

---

## [The improvement of memory management in multithreading Julia 1.10beta is amazing!](https://discourse.julialang.org/t/the-improvement-of-memory-management-in-multithreading-julia-1-10beta-is-amazing/102468)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 6\
**Last updated:** [March 29, 2024, 2:30am UTC](https://discourse.julialang.org/t/the-improvement-of-memory-management-in-multithreading-julia-1-10beta-is-amazing/102468 "2024-03-29T02:30:54Z")

</div>

I am so happy and can not help to share here. I have a multithreading script that reads tons of CSV files, processes them, and saves each back to disk. before 1.10, I see a continuous growing of memory usage like insanel…

[Next page](https://discourse.julialang.org/tag/memory/158.md?match_all_tags=true&page=1&tags%5B%5D=memory)
