Free memory used by vector

Free memory used by vector

Page 1 of 1

3 Replies - 5305 Views - Last Post: 21 April 2006 - 01:19 PM Rate Topic: -----

#1 lijojacobcs  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-March 06

Free memory used by vector

Posted 21 April 2006 - 08:21 AM

What is the function to free the memory used by a dynamic vector array?I am using push_back to insert into the vector. Instead of deleting the vector one by one from the array, I want to delete the entire array of vectors simultaneously.
Is This A Good Question/Topic? 0
  • +

Replies To: Free memory used by vector

#2 Thorian  Icon User is offline

  • Pirate Medic
  • member icon

Reputation: 22
  • View blog
  • Posts: 5,904
  • Joined: 06-June 02

Re: Free memory used by vector

Posted 21 April 2006 - 08:41 AM

Hello Memory vector guy Im going to transfer this to general programming as it does not appear to be an introduction
Was This Post Helpful? 0
  • +
  • -

#3 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Free memory used by vector

Posted 21 April 2006 - 11:26 AM

delete[] myVectorArray;


unless I've misuderstood...presuming you've allocated the memory with the new operator. Also presuming you are using C++, or a similar language. Please advise if not.
Was This Post Helpful? 0
  • +
  • -

#4 Wazaa  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-April 06

Re: Free memory used by vector

Posted 21 April 2006 - 01:19 PM

It's quite hard to understand what you mean. Half of your text implies that you got an array with dynamic vectors, while the other half says that you got a single vector. What Amadeus said is for the array that contains vectors, but for the single vector - just use:
vector._Destroy();


But probably I've misunderstood something - misunderstanding is an area in which I'm an expert. :)

Daniel
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1