Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak on View Render with Encodable Struct/Enum #215

Closed
dschwartz783 opened this issue Sep 9, 2022 · 2 comments · Fixed by #220
Closed

Memory Leak on View Render with Encodable Struct/Enum #215

dschwartz783 opened this issue Sep 9, 2022 · 2 comments · Fixed by #220
Labels
bug Something isn't working

Comments

@dschwartz783
Copy link

dschwartz783 commented Sep 9, 2022

Describe the bug

When decoding both Encodable structs and enums as a context object for a view render, I have found that there appears to be a small memory leak. The memory leak mostly vanishes when the route returns a View containing a ByteBuffer from a string, describing the struct, in that way ensuring everything else but the final render is compiled in. It does seem like there's still a tiny memory leak though, so it may be that the leak's still there, just significantly minimized.

To Reproduce

  1. Create a template project
  2. (to speed up the leak) Create a struct, and apply the struct to the template as a context object
  3. Stress test it with curl in an infinite while loop

Expected behavior

Memory stays mostly consistent within a normal range for the workload

Environment

This is all being run on Linux. Here's a copy of framework versions

  • Vapor Framework version: 4.65.1
  • Vapor Toolbox version: ...
  • OS version: Ubuntu 22.04.1 LTS

Additional context

This is completely consistent. I'd love some insight into what's going on here. This project is for a business, so I'll have to write some nasty workarounds if I can't figure this out. Best avoided, obviously.

@dschwartz783 dschwartz783 added the bug Something isn't working label Sep 9, 2022
@dschwartz783
Copy link
Author

found a reference cycle. I'll send in a PR in a bit.

@dschwartz783
Copy link
Author

PR: #216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant