Dead store
Encyclopedia
In Computer programming
, if we assign a value to a local variable, but the value is not read by any subsequent instruction, then it is referred to as a Dead Store. Dead Stores are wasteful of processor time and memory, and may be detected through the use of Static Analysis
.
Java example of a Dead Store:
In the above code an ArrayList object was instantiated but never used. Instead, in the next line the variable which references it is set to point to a different object. The ArrayList which was created when list was declared will now need to be de-allocated, for instance by a Garbage Collector
.
JavaScript example of a Dead Store:
"The code in the loop repeatedly overwrites the same variable, so it can be reduced to only one call."
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...
, if we assign a value to a local variable, but the value is not read by any subsequent instruction, then it is referred to as a Dead Store. Dead Stores are wasteful of processor time and memory, and may be detected through the use of Static Analysis
Static analysis
Static analysis, static projection, and static scoring are terms for simplified analysis wherein the effect of an immediate change to a system is calculated without respect to the longer term response of the system to that change...
.
Java example of a Dead Store:
In the above code an ArrayList
Garbage collection (computer science)
In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program...
.
JavaScript example of a Dead Store:
"The code in the loop repeatedly overwrites the same variable, so it can be reduced to only one call."