March 11th, 2009, 03:42 PM
destroying STL vectors explicitly?
I have a rather large, memory intensive program that I'm trying to slim down. Within this program are class instances parts of which have to persist to the end of the run and parts of which could be deleted earlier in order to slim things down. I know it may sound like a bad idea from a extensibility and reusability perspective, but I'd love to be able to destroy some STL vectors that become unnecessary to maintain. More specifically, I've got a "node" class with floats (x,y,z coords) and an stl vector that contains int indices of tetrahedra to which the nodes belong. STL works well here, because the number of tetrahedra varies from node to node.
Anyway, the code creates a vector of these nodes. After I do some things, I no longer need the vector of ints described above for each node. With millions of nodes, that space is precious to me.
So here's the question. Can I do something
Is there a better way? And if I do it this way, how do I randomly access the entries? Thanks ahead of time for any help!
inTetr = new vector<int>;
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!