This weakness occurs when a program relies on automatic boxing and unboxing of primitive types within performance-sensitive code sections, causing unnecessary computational overhead and potential resource strain.
Languages like Java and C# provide autoboxing (converting a primitive like `int` to an object like `Integer`) and unboxing (the reverse) to simplify code by handling conversions automatically. While convenient for general use, these operations secretly create new objects and add processing steps that degrade execution speed, especially inside tight loops or high-frequency operations. Using boxed primitives within generic collections or performance-critical areas—such as scientific computing, real-time processing, or low-latency systems—can lead to excessive memory allocation, increased garbage collection, and even resource exhaustion. This practice is best reserved only for bridging the gap between primitive APIs and object-based libraries, not for core computational logic where efficiency is paramount.
Impact: DoS: Resource Consumption (CPU)DoS: Resource Consumption (Memory)DoS: Resource Consumption (Other)Reduce Performance
Incorrect autoboxing/unboxing would result in reduced performance, which sometimes can lead to resource consumption issues.
javajava