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 241409

Summary: netbeans maxes out on memory
Product: cnd Reporter: tbrunhoff <tbrunhoff>
Component: DebuggerAssignee: petrk
Status: VERIFIED FIXED    
Severity: normal CC: mmirilovic
Priority: P1 Keywords: 8.0_HR_FIX
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: messages.log
gdb log (compressed with bzip2)

Description tbrunhoff 2014-02-04 21:44:03 UTC
Created attachment 144802 [details]
messages.log

Briefly, I'm trying to debug an application and both java and gdb alternately start burning 100% of the cpu. I have netbeans configured for 1.5GB of memory, but eventually java runs out when it hits this limit.

I don't have any watches set, and it takes about one minute to step one line in the debugger. My guess is that NB.

Interestingly, although I get an exception, the ide's reporting mechanism does not show up.

So if I just let the ide/gdb sit for a while, the memory consumption windows declines to under 1GB.  At that point I can step one line, and the memory consumption begins to rise quickly. Eventually, netbeans exited on its own and deleted the gdb log.
Comment 1 tbrunhoff 2014-02-04 21:52:23 UTC
After hitting step twice, the gdb log in /tmp had grown to 105MBytes. It appears the load comes from trying to render very, very large unsigned char arrays over and over.

There either needs to be some smarts in the ide side of the debugger or some settings that will limit the number of characters rendered.


Product Version: NetBeans IDE Dev (Build 201402040001)
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Linux version 3.12.6-200.fc19.x86_64 running on i386; UTF-8; en_US (nb)
User directory: /home/toddb/.netbeans/dev
Cache directory: /home/toddb/.cache/netbeans/dev
Comment 2 tbrunhoff 2014-02-04 21:55:24 UTC
Created attachment 144805 [details]
gdb log (compressed with bzip2)
Comment 3 tbrunhoff 2014-02-04 22:00:10 UTC
Running gdb by hand and printing out the same varibles yields about 100 bytes per array out of 2MBytes.
Comment 4 tbrunhoff 2014-02-04 22:13:32 UTC
And if I change the declaration of the arrays from unsigned char * to void *, the gdb log remains small and performance is good.

changing declarations is not acceptable. Please fix.
Comment 5 Alexander Simon 2014-02-06 08:04:01 UTC
see also memory dump in bug #241410
Comment 6 petrk 2014-02-10 11:34:39 UTC
*** Bug 241408 has been marked as a duplicate of this bug. ***
Comment 7 petrk 2014-02-21 18:05:21 UTC
Fixed in http://hg.netbeans.org/cnd-main/rev/7aad436e1942

Could be checked by creating a very big array of chars and while debugging point to it with a mouse to get tooltip. Tooltip should appear quickly and without significant memory changes. Also string in tooltip should be truncated.
Comment 8 tbrunhoff 2014-02-21 18:47:04 UTC
> Could be checked by creating a very big array of chars

... and fill it with non-null chars.  Sorry, I know this is completely obvious to most of you.
Comment 9 Quality Engineering 2014-02-22 06:13:43 UTC
Integrated into 'main-silver', will be available in build *201402220001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7aad436e1942
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #241409 - netbeans maxes out on memory
-- set gdb limit on number of returned elements in arrays (default limit x2).
Comment 10 soldatov 2014-02-25 09:35:25 UTC
In this case I see correct tooltip and Variables tab:

const int MAX = 1000000;

int main(int argc, char** argv) {
//    unsigned char s[MAX];
    unsigned char* s = new unsigned char[MAX];
    s[MAX - 1] = '\0';
    for (int i = 0; i < MAX - 2; i++) {
        s[i] = '*';
    }
    return 0;
}

In this case array breaks debugger:
const int MAX = 1000000;

int main(int argc, char** argv) {
    unsigned char s[MAX];
//    unsigned char* s = new unsigned char[MAX];
    s[MAX - 1] = '\0';
    for (int i = 0; i < MAX - 2; i++) {
        s[i] = '*';
    }
    return 0;
}

Scenario:
- Set Line breakpoint at "return 0;" line
- Start debugger
- Open Variables tab
- Expand 's' node
- Press "Finish Debugger Session" button
==> IDE can't finish debugger for a lot of time
Comment 11 petrk 2014-02-25 09:59:19 UTC
>const int MAX = 1000000;
>
>int main(int argc, char** argv) {
>    unsigned char s[MAX];
>//    unsigned char* s = new unsigned char[MAX];
>    s[MAX - 1] = '\0';
>    for (int i = 0; i < MAX - 2; i++) {
>        s[i] = '*';
>    }
>    return 0;
>}

I suppose the issue you described is not connected to this one. If the issue is reproducible please file another bug.
Comment 12 henk89 2014-02-25 10:37:06 UTC
fix is safe
Comment 13 soldatov 2014-02-25 10:42:02 UTC
Product Version    = NetBeans IDE Dev (Build 201402250001) (#e8eed61bc137)

QA verified bug. Now IDE truncates big tooltip.
Comment 14 soldatov 2014-02-25 10:43:20 UTC
(In reply to petrk from comment #11)
> I suppose the issue you described is not connected to this one. If the issue
> is reproducible please file another bug.
issue 242313 are created
Comment 15 Vladimir Voskresensky 2014-02-25 13:27:37 UTC
Petr, please integrate into release80
Comment 16 Quality Engineering 2014-03-03 00:47:30 UTC
Integrated into 'releases/release80', will be available in build *201403022200* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/732881972f92
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #241409 - netbeans maxes out on memory
-- set gdb limit on number of returned elements in arrays (default limit x2).
(transplanted from 7aad436e19426f093f7e0cee7fd5d5561ff2cee5)
Comment 17 soldatov 2014-03-06 12:23:56 UTC
verified in NetBeans IDE 8.0 (Build 201403052200)
Comment 18 soldatov 2014-03-21 20:41:46 UTC
verified in NetBeans IDE 7.4 (Build 20140320-3f80b6998498)
Comment 19 Quality Engineering 2014-03-26 17:06:02 UTC
Integrated into 'releases/release74', will be available in build *201403261440* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/884e97833a1b
User: Petr Kudryavtsev <petrk@netbeans.org>
Log: Fixed #241409 - netbeans maxes out on memory
-- set gdb limit on number of returned elements in arrays (default limit x2).
(transplanted from 7aad436e19426f093f7e0cee7fd5d5561ff2cee5)