0

In order to test and replicate Out of Memory issue on my local system, I'm thinking of creating a huge response body ( in string format)which ideally should exceed the heap memory of JVM.

Is it possible to create a very large string of around 2GB and then assign it to a response entity?

Please help.

Sandy
  • 459
  • 2
  • 6
  • 19
  • It doesn't need to specifically be in a response body object. You can get this error if any object exceeds the heap space. You should be able to do this with a String – Flaom Jan 19 '21 at 06:24
  • Check this link for string object size: https://stackoverflow.com/questions/31206851/how-much-memory-does-a-string-use-in-java-8 – Ajit Soman Jan 19 '21 at 06:54
  • @Flaom agree. But in my particular scenario, it occurred due to huge response body. I'll try to stream the response body, but in order to test that, I need a large response body – Sandy Jan 19 '21 at 08:58

0 Answers0