adspace
How the memory management in vectors are being done. What
happens when the heap memory is full, and how do you handle it ?
Answer Posted / Dhananjay Pal
In C++, vector manages its memory dynamically using the built-in library. When the capacity of a vector is reached, it automatically allocates more memory from the heap. If the heap memory is full, the program may crash or encounter errors. To avoid this, you can preallocate memory for vectors or handle exceptions.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers