ok, now that you explain the application, the it does not look like a stress test anymore.
so
typedef double p_3d[3];
is fixed.
And you dont want duplications so
you want AllPoints to keep all-the-points
while the triangles are formed using pointers to these points. Am i right ?
how about...