Something from my Data Structures class
11 years ago
One of my classes for programming explained to me a rather simple but common issue with programs. Rookie mistake professionals do sometimes. You'll see.
There are these things called "pointers." They are a type of a variable that handle the address of the memory location assigned to it (99% of the time for a variable assigned to it). An integer pointer stores the memory address for an integer that you assign to it.
But pointers can also be assigned a "new" variable. Just an unused memory address. Until the "new" variable is "deleted" it is still assigned to that program.
So I asked after class:
"If you make a bunch of 'new' variables, but do not 'delete' them, does that cause a memory leak?"
My professor replied:
"Yes, that's a memory leak. That's how Internet Explorer bloats your computer."
Ow.
It's confirmed, even my professors think IE is garbage.
This issue is really as simple as:
int* y;
y = new int;
*y = 5;
|...
//Then you use *y like it's any other variable.
|...
delete y; //This is the culprit.
y = NULL;
const string love = "I love you guys.";
cout << love << endl;
>I love you guys.
>
There are these things called "pointers." They are a type of a variable that handle the address of the memory location assigned to it (99% of the time for a variable assigned to it). An integer pointer stores the memory address for an integer that you assign to it.
But pointers can also be assigned a "new" variable. Just an unused memory address. Until the "new" variable is "deleted" it is still assigned to that program.
So I asked after class:
"If you make a bunch of 'new' variables, but do not 'delete' them, does that cause a memory leak?"
My professor replied:
"Yes, that's a memory leak. That's how Internet Explorer bloats your computer."
Ow.
It's confirmed, even my professors think IE is garbage.
This issue is really as simple as:
int* y;
y = new int;
*y = 5;
|...
//Then you use *y like it's any other variable.
|...
delete y; //This is the culprit.
y = NULL;
const string love = "I love you guys.";
cout << love << endl;
>I love you guys.
>
ISFoxMkloud
~isfoxmkloud
I guess I cannot say I did not see that coming.
SalemPertaeus
~salempertaeus
OP
I didn't either. I was like "Oh." Honestly surprised.
Amdor
~amdor
Lol nice xD
norzman5
~norzman5
I don't think any respectable computer professor thinks Internet Explorer is good
SalemPertaeus
~salempertaeus
OP
I completely agree.
FA+