posted 7 years ago
It's going to be hard to tell how you can improve this with no code.
First question is, how many rows are you reading from the db into your List?
Do you need to read them all or can you find a way to stream the results?
Looks like you're using the Spring DB stuff, so that's possibly not so easy to achieve.
You seem to be instantiating an expenseCase object (that should be ExpenseCase), which contains a Vehicle, which itself contains a List of something?
Do you need those?
Can you cut down the size of the object you are building?
Of course, the first thing you probably need to do is find out what exactly is taking up the memory...and for that you need a heap dump and some time analysing it.