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

[any] Excessive memory usage when generating examples #10199

Open
tlxtellef opened this issue Apr 23, 2020 · 0 comments
Open

[any] Excessive memory usage when generating examples #10199

tlxtellef opened this issue Apr 23, 2020 · 0 comments

Comments

@tlxtellef
Copy link

tlxtellef commented Apr 23, 2020

Description

The json strings generated to populate the example list is done in an exhaustive manner, regardless of usage. If there are recursion or deep hierarchies of models the resulting JSON strings can get massive, leading to excessive memory usage.

With examples generated:
With examples generated

no examples generated:
No examples generated

Swagger-codegen version

Master branch at revision 955ec39

Swagger declaration url

https://tripletex.no/v2/swagger.json

Command line used for generation

generate -i https://tripletex.no/v2/swagger.json
--lang java
-c ./config.json
-o ./build/generated
-Dapis -DapiTests=false -DapiDocs=false
-Dmodels -DmodelTests=false -DmodelDocs=false
-DsupportingFiles

config.json being

{
  "library": "jersey2",
  "dateLibrary": "java8",
  "java8": true
}

Steps to reproduce

Generate the client and observe the memory usage.

Related issues/PRs

Suggest a fix/enhancement

Override DefaultCodegen#getExamples in all generatores that don't use examples at all.
Or make the example json generation be on demand instead of being generated upfront regardless of their usage.

@tlxtellef tlxtellef changed the title [JAVA] Excessive memory usage when generating examples [any] Excessive memory usage when generating examples Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant