Memory leak when running GPU broadcast in a loop
- Dominant language
- Julia
- Stars
- 215
- Forks
- 37
- Avg merge
- 10h 47m
- Merged PRs (30d)
- 14
Description
I need to run GPU operations inside a loop, where the output of one iteration is used in the next one.
However, even very simple GPU broadcasts result in a memory leak and eventually I get OutOfMemoryError().
I am using oneAPI v.1.2.2 on WSL2 with Ubuntu on a Windows 10.
A very simple example that reproduces this is:
```
using oneAPI
gpu_array = oneAPI.zeros(Float32, 10_000_000)
for j in 1:5_000
gpu_array .+= 1
end
```
Is there something I am missing here?
I can see the GPU memory fill up in the Task Manager:

Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the provided Julia reproducer on oneAPI 1.2.2 and observing GPU memory during repeated `.+=` operations. Trace the GPU broadcast path and its allocation or lifetime behavior in oneAPI.jl. Done means the loop no longer continually increases GPU memory until OutOfMemoryError().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100