-
-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the issue
I’ve discovered a memory leak when using Vapor with Leaf templates. The leak only occurs when a context is passed to the renderer, regardless of whether the context is actually used in the .leaf file or not. The template can even be completely empty — the leak still happens. If no context is passed at all, there is no memory leak.
Vapor version
4.114.1
Operating system and version
macOS 15.5
Swift version
Swift Package Manager - Swift 6.1.0
Steps to reproduce
- Define a route that renders a Leaf template and passes any context.
- Use an .leaf template file.
- Send repeated requests to this route using a loop (e.g. curl loop with 100 iterations) to make the leak more visible.
- Observe memory usage — it keeps increasing steadily.
Note: The loop is used to accelerate the leak for demonstration purposes. Sending requests manually makes the leak harder to observe.
When changing req.view.render("some.leaf", context) to req.view.render("some.leaf") (i.e. no context), memory usage stays stable.
Outcome
No response
Additional notes
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working