C Programming Tutorials and advice
CProgrammingTrends News Archives About Us Feedback

Recent Articles

"Concepts" Separated From C++0x
More information regarding the next C++ standard has become available, but unfortunately, the news isn't all that good. The release date remains a while away...

A Collection Of The Best C++ Resources
I have used Google book search to find some of the best books in c++. Here are my collection. Nice book to start with your C++ learning and it should be one of...

State Of C++ Deemed Iffy With "Upside Opportunity"
Lots of subjects get covered by different "state of" talks. There's the State of the Union address delivered by the president, for example. There's also Conan...

Making Mistakes That Will Cost You Time And Money
Since the inception of software development, business development and technology departments have been locked in a death match. The main issue stems ...

08.20.09

Garbage Collection And C


By Doug Caverly

Garbage collection is an extremely undervalued aspect of modern society. After all, we couldn't be buzzing around in hybrids and enjoying our plasma TVs if we were buried in filth and suffering from the plague. So today, let's take a look at garbage collection in C-language code applications.

However much you love C, one thing that's hard to deny is that it doesn't provide native garbage collection. Steve Rhoads explained, "The lack of a garbage collector could be considered a limitation of C. However, it is possible to implement a trivial garbage collector if we are willing to live with a few limitations."

Rhoads then got into a couple technical series of instructions that we'll allow you to peruse for yourself. The key point is that, when all's said and done, you'll wind up further from a (figurative) trashy state.

So Simple, So Smart. Get The Online Backup
That Gives You Both. Download a Free Trial

Rhoads concluded, "This trivial garbage collector implementation enables the developer to focus on the algorithm and data structures instead of worrying about memory leaks. The garbage collector could be improved by adding semaphore protection to support multiple threads, and by placing an additional magic value at the end of all allocated memory blocks to better detect heap corruption."

And considering how much easier this tinkering is than the real garbage collection deal - running around in the street, hauling bags of smelly stuff - there's no excuse for not doing it.

About the Author:
Doug is a staff writer for WebProNews. Visit WebProNews for the latest eBusiness news.
About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice





CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com





-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2009 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact