This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 241891 - OutOfMemoryError: Java heap space
Summary: OutOfMemoryError: Java heap space
Status: RESOLVED DUPLICATE of bug 240475
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-14 19:28 UTC by javydreamercsw
Modified: 2014-07-31 14:36 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 205301


Attachments
stacktrace (206 bytes, text/plain)
2014-02-14 19:28 UTC, javydreamercsw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description javydreamercsw 2014-02-14 19:28:45 UTC
Build: NetBeans IDE 7.4 (Build 201310111528)
VM: Java HotSpot(TM) Client VM, 24.45-b08, Java(TM) SE Runtime Environment, 1.7.0_45-b18
OS: Windows 7

User Comments:
GUEST: Debugging a project - stopped on a breakpoint - CPU was being hammered and I couldn't cancel the debug

javydreamercsw: I guess ran out of RAM.

GUEST: left it running for a couple of days.




Stacktrace: 
java.lang.OutOfMemoryError: Java heap space
   at com.sun.tools.jdi.Packet.fromByteArray(Packet.java:114)
   at com.sun.tools.jdi.TargetVM.run(TargetVM.java:122)
   at java.lang.Thread.run(Thread.java:744)
Comment 1 javydreamercsw 2014-02-14 19:28:49 UTC
Created attachment 145216 [details]
stacktrace
Comment 2 Tomas Hurka 2014-02-17 13:32:44 UTC
byte[]#10693 has 23M items. It is held by "JDI Target VM Interface" thread. Reassigning to debugger for further investigation.
Comment 3 Ondrej Vrabec 2014-07-16 11:20:19 UTC
#712424: -Xmx256m - that won't work at all. Make it at least 1024m
#725906: one mega long instance of StringReferenceImpl held in JPDAObjectWatchImpl.value - might be a duplicate of bug 240475
Comment 4 Martin Entlicher 2014-07-31 14:28:47 UTC
I've verified that this works in the current dev version.
Most likely it was fixed by issue #240475.

*** This bug has been marked as a duplicate of bug 240475 ***
Comment 5 Martin Entlicher 2014-07-31 14:36:26 UTC
FYI: The program I was testing is:

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        bigStringWatch();
    }

    private static void bigStringWatch() {
        String bigString = createString(134000000);
        int l = bigString.length();
        bigString.hashCode();    // Line breakpoint here
    }

    private static String createString(int l) {
        char[] characters = new char[l];
        for (int i = 0; i < l; i++) {
            String is = Integer.toString(i, 36);
            characters[i] = is.charAt(is.length() - 1);
        }
        return new String(characters);
    }

with the line breakpoint at the comment.
When the breakpoint was hit, I've added this expression to Watches:
bigString.substring(1111, 120000000)
The IDE, after GC, was consuming less memory, that is the retained size of the String. Therefore it's fixed.