PHPStorm freezes due to huge workspace.xml due to many xml scratch files

Hello, dear JetBrains developers,

I'm using my PHPStorm on my current working computer for seven-eight months.
I recently noticed that it was freezing when saving an edited file. It hangs for 5-20 seconds, and it's just unusable.

I found some existing threads on that problem. However, none of them seemed to solve my issue.

While trying to solve the issue, I created a new project from source and renamed the folder ".idea" to ".idea.bak."
By accident, I saw that my workspace.xml was huge. Nearly 9MB and 130k lines of XML.

After I looked into it, I can imagine what slows down PHPStorm.

In that file are references to all scratch files including the info on what part of the scratch is folded.
This looks like:

<entry file="file://$APPLICATION_CONFIG_DIR$/scratches/scratch_362.xml">
     <provider selected="true" editor-type-id="text-editor">
     <state relative-caret-position="140">
     <caret line="7" column="46" lean-forward="false" selection-start-line="7" selection-start-column="46" selection-end-line="7" selection-end-column="46" />
                  <element signature="e#1002#1008#0" expanded="true" />
                  <element signature="e#1010#1016#0" expanded="true" />
                  <element signature="e#1022#1028#0" expanded="true" />
                  <element signature="e#1060#1066#0" expanded="true" />
For some Elements, this <folding> node is over 10k lines long!

As my projects include working with a lot of XML, I use that feature quite very often and have over 400 scratch files by now.
And those scratch XML can get quite massive.

So every time I will save something inside PHPStorm, it will read, parse, adjust and finally save this 8MB XML. This seems to drastically slow down the whole IDE.

I'm aware that I could delete all those scratch buffers and my problem "might" be solved. 

It would be great if PHPStorm would NOT store those scratch information in that "workspace.xml" but in a different file which won't be parsed/saved ever time I edit a file.
Or an option which allows me to turn off the feature, which keeps the info which element is folded, for scratch xmls at least.

I did not yet create an issue for that. But as I think that this problem could affect more users, it would be great if you could create one and fix this issue in a future version.

For now, the solution to just create a new project solved it for me. But this has the drawback that all my project specific settings (breakpoints, bookmarks,... ) are gone.


Hello, there are no similar reports on our bug tracker and this issue sounds serious. I would still suggest to report that out our bugtracker:


Hi Dmitry,
Thanks for the response. I'll try to create a reproducible example and will fill in a bug report.


Please sign in to leave a comment.