-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Memoize Virtus attribute and fix memory leak.
This one fixes a serious problem we faced in production under a heavy load. Investigation led us to the fact that it happens only when params are defined with `type: Array[SomeClass]`. In this case `Virtus` dynamically create some virtual classes (with `Class.new`) which inherits from base class with `DescendantsTracker` added which saves descendant classes into the array. Here we have a leak because garbage collector doesn't free these classes because an array still holds a reference to them. So at least I can say that `Virtus` isn't designed for creating things *dynamically*. They should be stored somehow statically.
- Loading branch information
1 parent
04a240a
commit bdd3f79
Showing
3 changed files
with
39 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters