Memory leak when using getOne in queryBuilder
See original GitHub issueIssue Description
I want to get the latest item with updatedAt sort by DESC. Im use the code like this:
this.customerRepository.createQueryBuilder().sort('updatedAt', 'DESC').getOne();
Expected Behavior
No memory leak.
Actual Behavior
I watch Monitor (on MacOS) and Memory of my application grow so fast. From 300MB to 1.5GB, sometime it grow to ~2GB.
// include the output in code tags like these!
Steps to Reproduce
- Refactor the code using .getOne() in chain and observer the result of memory.
// insert code here
My Environment
Dependency | Version |
---|---|
Operating System | MacOS |
Node.js version | v12.22.7 |
Typescript version | 4.2.3 |
TypeORM version | 0.2.40 |
Additional Context
Relevant Database Driver(s)
DB Type | Reproducible |
---|---|
aurora-data-api |
no |
aurora-data-api-pg |
no |
better-sqlite3 |
no |
cockroachdb |
no |
cordova |
no |
expo |
no |
mongodb |
no |
mysql |
yes |
nativescript |
no |
oracle |
no |
postgres |
no |
react-native |
no |
sap |
no |
sqlite |
no |
sqlite-abstract |
no |
sqljs |
no |
sqlserver |
no |
Are you willing to resolve this issue by submitting a Pull Request?
- ✖️ Yes, I have the time, and I know how to start.
- ✖️ Yes, I have the time, but I don’t know how to start. I would need guidance.
- ✖️ No, I don’t have the time, but I can support (using donations) development.
- ✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
TypeORM- findOne returns unexpected value - Stack Overflow
When I use TypeORM's findOne function to search for a Email which doesn't exist in the database, findOne returns the first entry to...
Read more >Improving Performance - Doctrine Object Relational Mapper ...
If entities hold references to large collections you will get performance and memory problems initializing them. To solve this issue you can use...
Read more >Making queries | Django documentation
To create an object, instantiate it using keyword arguments to the model ... This means things should work intuitively, so the abstraction doesn't...
Read more >Elastic-apm-node memory leak
Ever since I incorporated APM (elastic-apm-node) in some nodejs microservices they have developed memory leaks.
Read more >Test Driven Development with Node, Postgres, and Knex (Red ...
Knex is a SQL query builder that we can use with PostgreSQL to ... error handler // no stacktraces leaked to user app.use(function(err,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can you provide reproduction repository?
I have no specific cause ironed out yet, but I’ve just migrated from the v0.3.0-RC branch to 0.3.4 and I’m seeing constant GC failures and crashes.