Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
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
publicclassFoo{privateStringBufferbuffer1;// potential memory leak as an instance variable;privateStringbuffer2;privateStringBuilderbuffer3;// potential memory leak as an instance variable;}