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 269230 - Memory leak in Text Editor when perform open, search&replace and closed editor for multiple times
Summary: Memory leak in Text Editor when perform open, search&replace and closed edito...
Status: NEW
Alias: None
Product: editor
Classification: Unclassified
Component: Search (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-05 01:14 UTC by theng
Modified: 2016-12-05 01:35 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample XML to reproduce the issue (3.11 MB, text/xml)
2016-12-05 01:14 UTC, theng
Details
NetBeans\8.2\var\log (74.87 KB, application/octet-stream)
2016-12-05 01:16 UTC, theng
Details
Screenshot on the Memory Usage Part 1 (125.98 KB, image/png)
2016-12-05 01:35 UTC, theng
Details
Screenshot on the Memory Usage Part 2 (131.27 KB, image/png)
2016-12-05 01:35 UTC, theng
Details

Note You need to log in before you can comment on or make changes to this bug.
Description theng 2016-12-05 01:14:53 UTC
Created attachment 163145 [details]
Sample XML to reproduce the issue

Java Version    : JDK 1.8 Update 111
Netbeans Version: Netbeans 8.2


Observed behaviour:
1) The Search and Replace action in text editor hang more than 15 seconds when perform "open, search&replace and closed" on a large XML file (3MB) after repeating the action multiple times (around 5 ~ 7 times).

2) Based on the heap dump, a lot of objects with big size are not clear even when the text editor is closed and GC is performed via VisualVM. Those objects are from or.netbeans.lib.lexer.TokenHierarchyOperation, org.netbeans.modules.editor.NbEditorDocument, org.netbeans.modules.editor.lib2.document.CharContent

Expected behaviour:
1) Created objects should be cleared when the text editor is closed.
2) The process time for Search and Replace actions should <= 5seconds

Attached also with the heap dump generated by VisualVM for further investigation. This heap dump was took after the "hang" happens and GC performed (via VisualVM). Based on the JVisual VM, the "hang" process usually happens when the OldGen and Eden used space is high, and the memory cannot be cleared even editor is closed and performed GC via VisualVM.

Steps to reproduce
1) Create a new java project and put the XML file into the project
2) Open the 3MB XML file. (as attached)
3) Open the search and replace bar
4) Type "mapping" in the search bar and replace with "abc". The occurrences is around 24922
5) Perform replace all
6) Closed the XML file
7) Repeat step 2 to 6  more than 5 times(i.e. Open the XML file, retype the search keyword and click replace all)
Comment 1 theng 2016-12-05 01:16:05 UTC
Created attachment 163146 [details]
NetBeans\8.2\var\log
Comment 2 theng 2016-12-05 01:33:52 UTC
Have uploaded the heap dump file to http://deadlock.netbeans.org/job/upload/
Build Number: #1411
File Name: BugId269230.zip
Bud id: 269230
Comment 3 theng 2016-12-05 01:35:13 UTC
Created attachment 163147 [details]
Screenshot on the Memory Usage Part 1
Comment 4 theng 2016-12-05 01:35:35 UTC
Created attachment 163148 [details]
Screenshot on the Memory Usage Part 2