Kiran Kumar
Kiran Kumar

Reputation: 788

Out of memory exception - perm gen space when creating rest template

I am creating a rest template RestTemplate restTemplate = new RestTemplate(). But I am getting this error out of memory exception during the creation. When I debug the rest template creation, the error exactly is occuring at MappingJackson2HttpMessageConvertor It is a multi threaded environment, still only one thread is creating the template, rest other threads are doing some other process.

Upvotes: 0

Views: 512

Answers (1)

star67
star67

Reputation: 1832

OOM error is not about thread(stack) memory but about heap memory.

It looks like you have too many objects in memory - make a heap dump to analyze what exactly fills all the memory: useful link about capturing heap dumps

After an analysis of your specific case, as a solution (if it's okay to have such amount of objects in the memory) you may need to increase heap size via jvm parameter: -XX:MaxPermSize=512m

Upvotes: 1

Related Questions