When Java agents are runonserver, is there one heap or can there be many?

We have a situation where we will be running Java agents using the Agent.runonserver method. This will be happening a lot, and by many, so it won’t be uncommon for many people to be running these agents in this way at the same time. Does each run of an agent have it’s own heap, or is there only one heap for all to use?

I ask because we sometimes get outofmemoryerror errors (which crash the server), and this seems like it might be hapening more often when there are several people running the agents at the same time…

I have used the getRunTime method to check the max, total, and free memory at various times in the code, and it looks like each instance of an agent has it’s own heap… but it’s hard to tell.

Right now I am figuring that it’s one heap for everyone so I have alocated maxheapsize to 450MB; is this a mistake?

Thanks for any help.

Kevin

Subject: When Java agents are runonserver, is there one heap or can there be many?

Kevin -

Agents that run on the server run in the same VM so, yes, they share the same heap. Bumping the MaxHeapSize might work in the short term, but the design you’re considering will lack scalability. And you should expect OutOfMemory errors to be a common occurrence . . . more concurrent users = less available memory (as you’ve already noted).

dgg

Subject: RE: When Java agents are runonserver, is there one heap or can there be many?

Thanks, I appreciate your responding.

I got rid of the errors by fixing some design issues.

However, I am indeed worried about scalability…

Thanks again.

Kevin