Sublime Forum

Searching problem - XX characters selected instead of number of matches

#1

Hello,

I search a file for a pattern, say “abcd”. I see this occurs several times in the file but how many times? I don’t know because most of the time sublime says “Four characters selected” instead of number of occurrences.
Interestingly sometimes Sublime shows the information I look for but most of the time it is just the length of the searching pattern.
So is there some button to ask sublime to always show number of matches?

0 Likes

#2

The only time I’m seeing “X characters selected” is when it’s said “X characters selected; Unable to find ABCDE” for a couple seconds first.

0 Likes

#3

Thank for a reply bschaaf.
From what I see the search work find for relatively short files. However when I search 20k+ lines of a big log file, Sublime refuses to give a correct matches count and show how long the search string is… :expressionless:

0 Likes

#4

ST has a sanity limit for highlighting all matches in large files (16MiB) as it causes significant typing delay to search through the entire file. You can adjust this limit using the "find_highlight_matches_max_size" setting.

1 Like

#5

Thank you bschaaf, it seems to work now.

0 Likes

#6

Update:
If I search in REGEX mode the problem is still there - the bar shows numbers of characters selected only instead of number of occurences.

0 Likes

#7

See the setting below the one I previously mentioned.

1 Like

#8

I think this helped with this particular problem but now when I search entire project for some phrase I notice very high RAM usage spike (cpu is affected as well). 11Gb of RAM usage?? The project I work on is ~100 mb in size… what is going on?

It heppend even after I commented out commands like find_highlight_matches_max_size. My preferences.sublime-settings file looks like this:
{
“default_line_ending”: “system”,
“dictionary”: “Packages/Language - English/en_US.dic”,
“ensure_newline_at_eof_on_save”: false,
“always_prompt_for_file_reload”: false,
“font_size”: 11,
“show_encoding”: true,
“show_line_endings”: true,
“spell_check”: true,
“tab_size”: 8,
“theme”: “auto”,
“dark_theme”: “Default Dark.sublime-theme”,
“light_theme”: “Default Dark.sublime-theme”,
“draw_unicode_white_space”: “none”,
//“file_exclude_patterns”: [""],
//“find_highlight_matches_max_size”: 1073741824, // 1 Gb
//“find_regex_highlight_matches_max_size”: 1073741824, // 1 Gb
//“find_in_files_max_result_size”: 1073741824, // 1 Gb
“ignored_packages”:
[
“Vintage”,
],
“update_check”: false,
}

I have never experiences any performance issue with Sublime until today. As I said every search hangs.

0 Likes

#9

Does it happen in safe mode?

0 Likes

#10

@bschaaf, sorry for late response. No it does not happen is safe mode. Without safe mode I see sublime right after start consumes 4,5 GB of RAM and then if I search one of my open projects it jumps to 11GB for a moment and then gets down to 2GB. How can I debug what is causing it?
UPDATE: I only have two custom plugins installed - I removed one, and put the other under ignored setting. The problem is still there, why?

0 Likes

#11

In task manager if you expand the ST entry you should be able to see which process is using up your CPU/memory. It’s most likely a process spawned by a plugin.

0 Likes

#12

@bschaaf
image

As you can see there is only one Sublime process that consumes 3,3GB or RAM. Also I have now only one plugin installed and I have disabled it from settings:

That said I have no idea how to debug it further, please help.

0 Likes

#13

Have you opened your home folder, C-drive or similarly huge path? Is indexing running (Help > Indexing Status)?

0 Likes

#14

No, I have 4 projects open and neither one is being indexed by sublime at the moment. They have different sizes, some of them are small ~200Mb some are 3GB directories. They include .git directory as well (that alone is ~300 MB).

When I start sublime in --safe-mode and I open that 3GB project I see sublime only consumes 80 Mb of RAM. Otherwise 3GB+. Now, I removed all the plugins, so what may cause this difference? For me Sublime is not usable anymore in normal mode as it hangs.

Please help.

0 Likes

#15

Just to confirm you’re seeing this when running a find-in-files search on one of the projects and that’s what’s causing the high memory/cpu usage? Has the search completed?

0 Likes

#16

To be honest, right now I see this high RAM usage spike as soon as I start Sublime. It started noticing it suddenly when I was searching the whole project. I can’t recall any particular event or change in sublime setting that could have caused it.

0 Likes

#17

Is it associated with any particular window? You should be able to find out by closing windows until it goes away.

0 Likes

#18

When I start sublime it opens all previously used projects (which is great), unfortunately I see that huge RAM spike right after it was started. However, if I let it stay this way (no closing of Sublime) I notice it gets back to normal ~200 Mb of RAM usage. Now the crucial point - it is enough for me to start searching the whole project for some phrase and it jumps up to 7GB of RAM!
Yes I have been able to narrow it down to a project causing this problem. But what can I do next? There is no “window” I can close other than sublime itself.

0 Likes

#19

You say it opens all projects but you’re only using one window? Have you open the folders of all projects in the side-bar? What’s the indexing status (Help > Indexing Status)?

0 Likes

#20

No 4 different instances of sublime. Only one is causing RAM spike. Indexing status, as I mentioned above, is always idle.

0 Likes