memory question, can you specify max memory?

  • Thread starter Thread starter Derrick
  • Start date Start date
D

Derrick

I am getting an out of memory exception when spinning up a few hundred
threads all processing sizable amounts of XML. Is there any way to specify
min/max heap as there is with the java -Mx128 type switches to the JVM?
(don't remember the exact syntax of the jvm param)

Thanks in advance!

Derrick
 
I am getting an out of memory exception when spinning up a few hundred
threads all processing sizable amounts of XML. Is there any way to specify
min/max heap as there is with the java -Mx128 type switches to the JVM?
(don't remember the exact syntax of the jvm param)

I think it's the default stack size you want to change, not the heap.
You can do that with Exitbin.exe and its /stack option. However, I
would recommend reconsidering your design first. Do you really need
hundreds of threads running? Why not use the thread pool?



Mattias
 
I don't think so. Out of memory are not stack overflow exceptions.
Increasing the statck size here would only make things worse.

Willy.
 
No you can't, the max. process space is exceeded.
The overflow is due to the amount threads you are creating, each thread has
a reserved default stack of 1MB, so if you say a few hundred threads you
take a few hundred MB as stack space alone, add to that amount the space
taken by your application (especially the XML data) and you are exceeding
the maximum size of your system's virtual memory size (free RAM size + free
page file space).
What you should do is reduce the number of threads to a reasonable number,
say # CPU + 1 if your thread procedures are executing a fair amount of IO or
simply a single thread if no IO is done at all.

WIlly.
 
Back
Top