ReadIfExists memory leak?

Hello.
I'm use Gigaspaces 7.1.1 and Java 1.6.0_17 on Linux. And in my project I use SOAP service, which use remote tasks, which read objects from space and return results.
For additional - I'm use the mirror service for initial load POJO from database and use SQL Query for read objects from space. And when I write application for testing handle requests - I see, what memory, which gigaspaces uses - is grown(about 1-1,5 Gb). I'm use 10 threads, which do the requests 100000 requests for each.

When I execute Full GC after test(I'm use "jmap -histo:live" command for that) - memory is not reduced.
I'm attached screenshot with my profiling(percentage shows how each method created objects). Please, ignore the the black area - it's just our service calls.
h4. Attachments

Comments

Hi.
I'm easy call readIfExists in "for loop" for 10 threads. In space I have 4,5 millions entries. I'm not use the transaction and timeout is 0 value.
For now I'm use sql query for read entries from space and have memory leaks. But when I change sql query template to object template - the problem is gone.

For now I'm execute SQLQuery<pojo> query = new SQLQuery<pojo>("id = 'myId'") for each thread and each iteration.
For exclude memory leak - I need to use predefined SQLQuery(for example - "private static final SQLQuery<pojo> query = new SQLQuery<pojo>("id = ?")") or I need to use predefined Strings and on each iteration I may create new SQLQuery, but use constants strings?

There is internal mechanism to cache SQLQuery according to their string not the actual SQLQuery instance in memory, this is an optimization that reduces the need to parse the string every time and reduce the need construct the syntax tree for every query.
So if on each iteration you use a different string, the caching is redundant and the tree is parsed and created and cached everytime (there might be a leak in that case).

But regardless of the potential leak, you should not use on each iteration a different string if its syntax is the same and only the values are different since you are losing the advantage of the optimization.
You should always use the parameterized form to gain this benefit unless your query is always with the same values, which I guess is not your case otherwise you wouldn't encounter this issue.