APIDevTools / swagger-parser

Swagger 2.0 and OpenAPI 3.0 parser/validator
https://apitools.dev/swagger-parser
MIT License
1.1k stars 155 forks source link

Memory Leak reported in core #121

Closed assimoes closed 5 years ago

assimoes commented 5 years ago

Hello!

I have been using swagger-parser since version 4.x.x, mostly as a dependency of hapi-swagger. I have never had the need to create a service that uses swagger-parser directly. However, today I had that need and every time I require this package, the test runner reports a memory leak in core.

image

If I comment the require to this package on my SUT the memory leak is no longer reported.

Also, I have tried several versions of this package including the latest. The issue is the same.

Any hints?

JamesMessinger commented 5 years ago

What tool are you using to detect leaks? Are you sure this is a memory leak? Based on the screenshot you posted, it looks like a global leak, not a memory leak.

assimoes commented 5 years ago

Hi, you are right. It is a global leak. Im using labjs.

assimoes commented 5 years ago

Truth is we have been using this lib for quite a while without any side effects.

JamesMessinger commented 5 years ago

I don't think this is anything in Swagger Parser. It may be in some dependency of Swagger Parser, or it may be in some dependency of your application. My hunch is that it's caused by core-js, which could be getting injected into your build if you're using a transpiler/bundler such as Babel, TypeScript, WebPack, etc.

I'm going to mark this issue as closed, but feel free to continue commenting here if you have more questions or if you discover the culprit. I'd love to know!

assimoes commented 5 years ago

That is indeed the case. After checking other of our internal projects, we are ignoring core-js global leaks on the test runner.

A sábado, 29/06/2019, 14:11, James Messinger notifications@github.com escreveu:

I don't think this is anything in Swagger Parser. It may be in some dependency of Swagger Parser, or it may be in some dependency of your application. My hunch is that it's caused by core-js https://www.npmjs.com/package/core-js, which could be getting injected into your build if you're using a transpiler/bundler such as Babel, TypeScript, WebPack, etc.

I'm going to mark this issue as closed, but feel free to continue commenting here if you have more questions or if you discover the culprit. I'd love to know!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/APIDevTools/swagger-parser/issues/121?email_source=notifications&email_token=ABQKHDFXFOTBYGUXIU6XNH3P45NRXA5CNFSM4H4FACN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY3YRFY#issuecomment-506955927, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQKHDCA3V5S2OYLLL7VG63P45NRXANCNFSM4H4FACNQ .