Arrrrgg! I don't know what happened, but for some reason I've stopped being notified for activity on this thread.
I'm really glad I checked manually.
Out of interest, why? It almost sounds like
you're trying to directly port a C memory pool, when a proper OO
object pool would work just as well (if not better). Unless you really
are doing something freaky that is.
Dear Orangy Tang,
The issue is RAM blowup (and cache discontinuity??)
My algorithms may certainly be improvable. However, I don't think
that what I'm doing, would be unreasonable in C(resource-wise.)
Our last discussion(another thread,) surely helps a lot.
(I'm not trying to port a C program, quite the contrary: I'm
considering porting existing (and so-so working) Java code into
JNI/C.)
If you like to know, it's a terrain rendering algorithm. I got the idea from:
http://www.flipcode.com/tutorials/geomipmaps.pdf(Just glanced at it; no patience to read the details fully.)
The quad tree, is probably a major cause of the RAM blowup.
-----------------------------------------------
The general question about Java (in the long run, and my specific
problem aside) is this:
Suppose you have many nested objects:
class Quad {
short [] x_range = new short[2]; // small array; overhead
short [] y_range = new short[2]; // small array; overhead
QuadNode [][] children; // small array(s); overhead
// more small stuff; overhead
};
Moreover, you must new() everything. In C, I use large array;
malloc overhead =~ 0.
So, what is the right way to do this in Java?
If I'm being freaky, let me know please.
Regards, Reza.
PS:
I _will_ look at the canyon demo's source code. Ken pointed that out,
on the JOGL thread, and the demo runs fast :-)
Looking forward to it.