Este producto no es compatible con el sitio Datadog seleccionado. ().
Esta página aún no está disponible en español. Estamos trabajando en su traducción.
Si tienes alguna pregunta o comentario sobre nuestro actual proyecto de traducción, no dudes en ponerte en contacto con nosotros.

Metadata

ID: java-best-practices/string-buffer-field

Language: Java

Severity: Warning

Category: Best Practices

Description

StringBuffers and StringBuilders have the potential to grow significantly, which could lead to memory leaks if they are retained within objects with extended lifetimes.

Non-Compliant Code Examples

public class Foo {
    
    private StringBuffer buffer1;    // potential memory leak as an instance variable;
    private String buffer2;
    private StringBuilder buffer3;    // potential memory leak as an instance variable;

}

Compliant Code Examples

public class Foo {
    
    public void method() {
        StringBuffer buffer;
    }
    
}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Integraciones sin problemas. Prueba Datadog Code Security