Memory allocated?

Hi, I have a pretty big std::vector<matrix>, where matrix is a custom class defined by me. I would like to know how much memory has been allocated to that vector at a certain point in time. Is there any way of doing this in c++?

Or is my only shot, taking a look at the task monitor of windows/unix/whatever at execution time to estimate this?

Thanks! :)

C :)
OP wrote:
Or is my only shot, taking a look at the task monitor of windows/unix/whatever at execution time to estimate this?


That will give you memory usage of the process, and not the vector only.
Have you tried the sizeof() operator?

Aceix.

 
 That will give you memory usage of the process, and not the vector only.

yep, I am aware of that. However, It is pretty much the only "big fish" in my tank, so I WOULD be able to at least get a ROUGH estimate of the std::vector.

Have you tried the sizeof() operator?

my std::vector, in this case, contains 125970 matrix instances, where matrix is:

1
2
3
struct matrix{
	std::vector<avector> vectors;
};


and "avector" is:

1
2
3
struct avector{
	std::vector<double> doubles;
};



So, with 125970 matrices, sizeof(matrices) returns 12, which does seem a bit small. or do I need to multiply this by 125970, I.e. the num matrices in the vector?

I am not exactly sure how to interpret/read the result of sizeof()

Topic archived. No new replies allowed.