Re: C++ and I are getting divorced.

  • From: "Bill Gallik" <BillGallik@xxxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 28 Jul 2010 12:34:54 -0500

Joseph writes:
"memory management is just a practice you might need to do since we don't want a program eating more and more memory when it shouldn't (I guarantee you'll be fighting with your computer about that dispute later...)."

Ah YES, memory management and the pitfalls therein. There lies one of the main bullets that get copied at least 10 times, allocated memory not being freed after no longer needed. But truthfully, pointers and memory management is not the ogres purported to be. Here's the deal:

Pointers - a pointer is an address in memory that stores the address of a bit of memory. What tends to be confusing is that (in C/C++ anyways) you can have a pointer to a short, long, char, float, double and various types of arrays. What makes this confusing is that, although the memory addressed in a pointer might be any of those specific types - the pointer address itself is always a long integer because it identifies the address where the desired memory begins.

memory management - basically this is the science/art of making sure that when additional memory is allocated that the programmer take care to be sure to free up that memory after it is no longer needed. If this isn't done, the program (the data section actually) may grow and grow and grow. So what's wrong with this? Well, even on the largest computers memory does have a finite limit; if the program continues to grab memory there's a host of undesirable consequences.
----
Holland's Person, Bill
E-Mail: BillGallik@xxxxxxxxxxxxxx
- The early bird may get the worm, but the second mouse gets the cheese!
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: