What Does Garbage Mean?

Garbage, in the context of computers, is used to refer to any unwanted or unused data occupying memory space. Unallocated memory must be free of garbage values before allocating them, as the presence of garbage values may cause security issues and exceptional conditions.


Techopedia Explains Garbage

Under normal usage, the word garbage refers to any waste product or something that is no more useful. Just as garbage does not occur naturally in the real world, garbage in the computing world is also created by programmers and their style of writing programs.

In computing terms it may refer to either of two meanings:

  • Anything that is unreadable or unviewable on the computer screen to a normal user may be perceived to be a garbage file or value. This may occur when the user is trying to open a corrupted file or a file of a format that is not supported by the system.
  • From a programming point of view, the term garbage is used to point to unwanted data held by the primary memory. These data may have been stored in the memory by a previous program and is unwanted and unusable for the current program execution.

When users write programs, the presence of garbage values must be addressed as these can cause runtime issues during program execution. Programming languages like C and C++ do not provide any automatic garbage management features, and hence when writing programs in these languages, the programmer must free all the allocated memory before the associated objects are destroyed. Programming languages like Java and .NET framework languages provide automatic garbage collection features, freeing the programmer from the memory deallocation issues.

When manual memory allocation and freeing of memory is not done properly, human errors may cause bugs or serious threats to system security. When the programmer fails to free the memory after its use, memory leaks may occur and there is also a chance of system crashes due to dangling pointers.


Related Terms

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…