I am reading very small yaml files (3 kb to 330 kb) , converting into the JsoneNode and then converting it into OpenAPI objects, while I am deploying my code on a k8 setup, I can see huge memory spike like 500-600 MB during the below code run: ,
String content = ClasspathHelper.loadFileFromClasspath("test.yaml");
final JsonNode jsonNode = JSON_MAPPER_FOR_YAML.readTree(content); //here JSON_MAPPER_FOR_YAML = ObjectMapperFactory.createYaml();
OpenAPI openAPI = new OpenAPIDeserializer().deserialize(jsonNode, path, new ParseOptions())
//Earlier ,I had tried below option as well but of no use in terms of memory spikes
OpenAPI openAPI = new OpenAPIV3Parser().parseJsonNode("/" + "test.yaml", jsonNode).getOpenAPI()
Trying to understand how such small yaml files can cause 500-600 MB memory spikes . I dont see such memory spikes when I run the same code in intellij and use jprofiler to see the memory .
Any one has any idea?