[Tfug] Need help with a C++ algorithm

Jude Nelson judecn at gmail.com
Thu Mar 15 00:21:55 MST 2007


Is there a way to determine the size of an allocated block of memory if only
a pointer to it is known?

Example:

int* p_int = new int[some_random_unknown_variable];

Is there a way to determine the size of the memory that was allocated, given
that information?  Yes, I've heard of vector; I don't want to use it (too
much overhead, inefficient with large numbers of elements, etc.).

Thank you in advance.



More information about the tfug mailing list