问题
I'm working on a project involving some large XML files (from 50MB to over 1GB) and it would be nice if I could view them in eclipse (simple text view is fine) without Java running out of heap space. I've tried tweaking the amount of memory available to the jvm in eclipse.ini but haven't had much success. Any ideas?
回答1:
I am not sure you can open such large files, as stated already in 2005.
You will end up with
!MESSAGE Unable to create editor ID org.eclipse.ui.DefaultTextEditor: Editor could not be initialized.
!STACK 0
java.lang.OutOfMemoryError: Java heap space
every time 'as mentioned in this thread).
I just tested that with the comment.xml of the latest SO dump: 350Mo.
(Stack Overflow Data Dump - Nov 09\Content\so-export-2009-10\comments.xml)
It took me a Xmx
(see my eclipse.ini) set to more than 3Go to be able to:
- open it
- switch to another file (that is when of tries a quick diff on the file you just left, and consume even more memory)
So it is simply not the right tool (and I tested it with eclipse3.6M3, latestest JDK, on a Windows7 Ultimate and 4GoRAM...).
Couple of notes:
- if your file is not the one being displayed in your workspace when you open eclipse, eclipse will not try to consume any memory for that file yet. It will wait until you select it for display.
- Switching from that file triggers a quick diff (because of the 'local history' option.
- closing the file will not free any memory (not until a full eclipse restart)
So at this point, a tool like the one I mention in the question Best Free Text Editor Supporting More Than 4G Files?: Large Text File Viewer (even though its site, swiftgear) is down since late 2008, is a valid alternative.
回答2:
I don't think it's possible, I have also struggled with large XML files and it basically kills Eclipse. Try using some other tool.
I usually use BareTail to view large files. It's not XML-oriented, but can view GBs of files.
回答3:
Try XMLMax. It is a virtual xml editor that can handle any size file and display it in a treeview. Google XMLMax editor.
来源:https://stackoverflow.com/questions/1692329/viewing-large-xml-files-in-eclipse