K
Kevin Spencer
To me the real issue around GC is that in heavy load situations is that
Garbage Collection is not an excuse for poor memory management. However,
there are quite a few poor programmers out there, people who expect
Microsoft to do all the work of writing their programs for them, from cradle
to grave.
The .Net platform has many levels of development, from high-level classes
which work like Swiss Army knives (and are about as large compared to a
smaller tool as a Swiss Army Knife is compared to a kitchen knife) to
low-level unmanaged coding capabilities, and the ability to make Windows API
calls, use pointers, and everything that can be done in a "traditional"
programming platform, e.g. C++. A good developer is aware of the
environment, and manages memory well, rather than relying on Microsoft to
handle whatever he/she throws at them.
One excellent example is the use of strings. Yes, strings are managed.
De-reference one and it will be de-allocated at some point in the near
future. But why on earth would Microsoft have created the StringBuilder
class if it wasn't necessary to use one from time to time? Under the hood, a
string is still an immutable array of char. So, concatenating a string to
another string does 3 things, behind the scenes:
1. A new char array is created, allocating the size of both strings
combined.
2. The 2 source strings are read into the new array.
3. The 2 source arrays are discarded.
In other words, the amount of memory consumed by concatenating 2 strings is
temporarily twice the size of the 2 strings combined. Imagine the amount of
memory consumed by an application that does a lot of this! And, sadly,
because many "professional" programmers know very little about what is
happening inside their app, this particular scenario is played out over and
over again. I have even seen posts about the system running out of memory
due to this sort of poor practice.
A good developer educates him/her self about what is going on "under the
hood," and takes responsibility for managing memory, processor, and other
system resources. The purpose of Garbage Collection is to prevent memory
leaks, nothing more. It is not a panacea for sloppy programming.
The apps I write are fast and efficient. And I write nothing but .Net apps.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
I'd rather be a hammer than a nail.
it bogs down to the point of bringing the system to a crawl. .Net 2005
may easy this some, I haven't had a chance to test it there.
But from what I've seen the current 2003 version's generational GC
system just doesn't cut it in high memory load situations. The ADO
libraries seem to call GC way to frequently as well which adds to the
problem.
Garbage Collection is not an excuse for poor memory management. However,
there are quite a few poor programmers out there, people who expect
Microsoft to do all the work of writing their programs for them, from cradle
to grave.
The .Net platform has many levels of development, from high-level classes
which work like Swiss Army knives (and are about as large compared to a
smaller tool as a Swiss Army Knife is compared to a kitchen knife) to
low-level unmanaged coding capabilities, and the ability to make Windows API
calls, use pointers, and everything that can be done in a "traditional"
programming platform, e.g. C++. A good developer is aware of the
environment, and manages memory well, rather than relying on Microsoft to
handle whatever he/she throws at them.
One excellent example is the use of strings. Yes, strings are managed.
De-reference one and it will be de-allocated at some point in the near
future. But why on earth would Microsoft have created the StringBuilder
class if it wasn't necessary to use one from time to time? Under the hood, a
string is still an immutable array of char. So, concatenating a string to
another string does 3 things, behind the scenes:
1. A new char array is created, allocating the size of both strings
combined.
2. The 2 source strings are read into the new array.
3. The 2 source arrays are discarded.
In other words, the amount of memory consumed by concatenating 2 strings is
temporarily twice the size of the 2 strings combined. Imagine the amount of
memory consumed by an application that does a lot of this! And, sadly,
because many "professional" programmers know very little about what is
happening inside their app, this particular scenario is played out over and
over again. I have even seen posts about the system running out of memory
due to this sort of poor practice.
A good developer educates him/her self about what is going on "under the
hood," and takes responsibility for managing memory, processor, and other
system resources. The purpose of Garbage Collection is to prevent memory
leaks, nothing more. It is not a panacea for sloppy programming.
The apps I write are fast and efficient. And I write nothing but .Net apps.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
I'd rather be a hammer than a nail.