JDK-8036882 : [macosx] Native memory leak in Java_sun_lwawt_macosx_CImage_nativeGetNSImageRepresentationSizes
Type:Bug
Component:client-libs
Sub-Component:java.awt
Affected Version:9
Priority:P3
Status:Resolved
Resolution:Fixed
Submitted:2014-03-07
Updated:2014-09-22
Resolved:2014-03-28
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The sortedPixelSizes leaks. Instruments also report malloc 16 bytes leak, but I can't track the reason.
Comments
Test code:
-------------------------
import javax.swing.*;
import java.awt.*;
public class Test {
private static JFrame f;
public static void main(String[] args) throws Exception {
for (int i = 0; i < 1000; i++) {
Toolkit.getDefaultToolkit().getImage("NSImage://NSGenericApplication");
Thread.sleep(1000);
}
}
}
-------------------------
27-03-2014
I think that adding autorelease like this [[[NSMutableArray alloc] init] autorelease] would help.