Closed ingebot closed 3 months ago
Comment author: Jeroen Frijters <jeroen@frijters.net>
There's a memory leak in java.text.DecimalFormat. Everytime you call format the attributes ArrayList is grown.
Here's repro test case:
import java.text.*;
class Leak
{
public static void main(String[] args)
{
DecimalFormat d = new DecimalFormat("#.0000");
for (;;)
d.format(0.0);
}
}
Comment author: Ben Tatham <bentatham@nanometrics.ca>
Created attachment 26464 memory leak fix
Here is a patch for this memory leak in DecimalFormat.
Note that DecimalFormat#formatToCharacterIterator(Object) is (still) not thread-safe and using it across multiple threads it may result in strange behaviour and/or NullPointerExceptions.
Attached file: DecimalFormat.patch (application/octet-stream, 876 bytes) Description: memory leak fix
Note: this issue was migrated automatically using bugzilla2github
Original bug ID: BZ#30977 From: Jeroen Frijters <jeroen@frijters.net> Reported version: 0.93 CC: bug-classpath@gnu.org, xiaoyuanbo@yeah.net