RE: C++ and I are getting divorced.

  • From: "Joseph Lee" <joseph.lee22590@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 28 Jul 2010 10:55:01 -0700

Hi Bill,
Great explanation... I'll put your words (via credits) on my blog as part of
my C++ notes series...
The condition that Bill describes is logically called "memory leak". A chief
problem is when a programmer uses dynamic memory and forgets to free it
(especially contiguous space and forgetting that one needs to use brackets
to free it), among other proboems. Newer languages such as Java uses
"garbage collection" to do this automatically (I think Alex H. would have
more say on that matter).
Cheers,
Joseph

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Bill Gallik
Sent: Wednesday, July 28, 2010 10:35 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: C++ and I are getting divorced.

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

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.441 / Virus Database: 271.1.1/3032 - Release Date: 07/27/10
18:34:00

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: