Try setting the maximum heap size rather than stack size. I would not have thought 2000 is a lot; you will probably find there is enough space on the stack for 5000 method calls, which is a lot bigger than 2000.
Are you sure the size you are setting is in kB rather than stack elements?
Even I had got that error, though I don't remember how many double variables I had used.
In your code example the memory required to store 5028 doubles is around 40k, much more than the specified 1k. It would take only 128 doubles to fill up this memory. I am unable to understand the behaviour.
Girish K Gupta
SCJP 1.5 - 87%, SCWCD 1.5 - 92%
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
how do I do my own kindle-like thing - without amazon