Sublime Forum

Dev Build 3131

#1

Hi guys! Great to see new dev versions out of the oven in a matter of days!

Just forgot my computer open from yesterday with sublime text open to find it out of memory today: sublime went to 61GB of ram with a nasty memory leak somewhere.

Forgot to say: Mac OS here.

1 Like

#2

Have you reverted to a freshly installed state to see if one of your plugins is to blame? http://www.sublimetext.com/docs/3/revert.html

1 Like

#3

Reverted to a pristine install, changed some user settings. theme to Adaptative and installed package Control only.

Fine until now.

I have a strong suspicion about a particular package (a clock on the Status Bar called StatusBarTime), I will try that now.

0 Likes

#4

Left it open some hours with only Package Control and StatusBarTime installed, no apparent memory leak.

I have a rather extensive list of packages normally installed:

  • 1337 Color Scheme (not in use anymore)
  • AdvancedNewFile
  • Alignment
  • All Autocomplete
  • ayu (using only a color theme here)
  • BracketHighlighter
  • ChordPro
  • ColorSublime
  • DocBlockr
  • Fix Mac Path (I don’t know if that is needed anymore?)
  • GitGutter
  • GitSavvy
  • Inspired GitHub Color Scheme (not in use anymore, too)
  • Jinja2
  • Laravel Blade Highlighter
  • laravel-blade
  • Package Control
  • PackageResourceViewer
  • PHP Companion
  • PHP Getters and Setters
  • Pretty JSON
  • SideBarEnhancements
  • Status Bar Time
  • SublimeCodeIntel
  • SublimeLinter
  • SublimeLinter-php
  • SublimeLinter-phpcs
  • SublimeLinter-phplint
  • Theme - Brogrammer
  • TodoReview
  • Xdebug Client

EDIT: and back to my normal configuration I see its not only a memory leak, something is taking the CPU over, I see the beachball of death all the time now.

0 Likes

#5

Call graph: 2498 Thread_35341339 DispatchQueue_1: com.apple.main-thread (serial) + 2498 start (in Sublime Text) + 52 [0x10e965bb4] + 2498 main (in Sublime Text) + 3215 [0x10e966bef] + 2498 px_run_event_loop() (in Sublime Text) + 190 [0x10ebf6abf] + 2498 -[NSApplication run] (in AppKit) + 926 [0x7fff748947ab] + 2498 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit) + 2796 [0x7fff7501b85e] + 2498 _DPSNextEvent (in AppKit) + 1120 [0x7fff7489fe24] + 2498 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox) + 71 [0x7fff76304b26] + 2498 ReceiveNextEventCommon (in HIToolbox) + 432 [0x7fff76304cf1] + 2498 RunCurrentEventLoopInMode (in HIToolbox) + 240 [0x7fff76304ebc] + 2498 CFRunLoopRunSpecific (in CoreFoundation) + 420 [0x7fff76da31c4] + 2498 __CFRunLoopRun (in CoreFoundation) + 2065 [0x7fff76da3c31] + 2498 __CFRunLoopDoTimers (in CoreFoundation) + 298 [0x7fff76dac4ea] + 2498 __CFRunLoopDoTimer (in CoreFoundation) + 1071 [0x7fff76dac98f] + 2498 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation) + 20 [0x7fff76dacd04] + 2498 __NSFireTimer (in Foundation) + 83 [0x7fff78835f3f] + 2498 ns_work_queue_runner::run_items() (in Sublime Text) + 168 [0x10ebf59a4] + 2498 std::__1::__function::__func<index_controller::set_folder_list(SP<folder_list>)::$_2::operator()() const::'lambda'(), std::__1::allocator<index_controller::set_folder_list(SP<folder_list>)::$_2::operator()() const::'lambda'()>, void ()>::operator()() (in Sublime Text) + 1156 [0x10e9d5a36] + 2498 std::__1::function<void (int)>::operator()(int) const (in Sublime Text) + 30 [0x10ea0d4ce] + 2453 std::__1::__function::__func<index_controller::set_folder_list(SP<folder_list>)::$_2::operator()() const::'lambda'()::operator()() const::'lambda'(int), std::__1::allocator<index_controller::set_folder_list(SP<folder_list>)::$_2::operator()() const::'lambda'()::operator()() const::'lambda'(int)>, void (int)>::operator()(int&&) (in Sublime Text) + 259,303,... [0x10e9d5f03,0x10e9d5f2f,...] + 45 std::__1::__function::__func<index_controller::set_folder_list(SP<folder_list>)::$_2::operator()() const::'lambda'()::operator()() const::'lambda'(int), std::__1::allocator<index_controller::set_folder_list(SP<folder_list>)::$_2::operator()() const::'lambda'()::operator()() const::'lambda'(int)>, void (int)>::operator()(int&&) (in Sublime Text) + 206 [0x10e9d5ece] + 45 wildcard_imatch(include_exclude_filter const&, substring) (in Sublime Text) + 64 [0x10ec28180] + 40 wildcard_imatch(std::__1::vector<parsed_pattern, std::__1::allocator<parsed_pattern> > const&, substring) (in Sublime Text) + 74 [0x10ec2811c] + : 37 wildcard_imatch(substring, pattern_classification, substring) (in Sublime Text) + 57 [0x10ec280cc] + : | 36 substring::ends_with_ignore_case(substring const&) const (in Sublime Text) + 46 [0x10ec255a0] + : | + 30 strncasecmp (in libsystem_c.dylib) + 13,0,... [0x7fff8c5975fb,0x7fff8c5975ee,...] + : | + 5 strncasecmp_l (in libsystem_c.dylib) + 109,249,... [0x7fff8c59755c,0x7fff8c5975e8,...] + : | + 1 strncasecmp (in libsystem_c.dylib) + 31 [0x7fff8c59760d] + : | + 1 pthread_getspecific (in libsystem_pthread.dylib) + 0 [0x7fff8c71da4a] + : | 1 strncasecmp (in libsystem_c.dylib) + 64 [0x7fff8c59762e] + : 3 wildcard_imatch(substring, pattern_classification, substring) (in Sublime Text) + 36,48,... [0x10ec280b7,0x10ec280c3,...] + 3 wildcard_imatch(std::__1::vector<parsed_pattern, std::__1::allocator<parsed_pattern> > const&, substring) (in Sublime Text) + 52 [0x10ec28106] + : 3 substring::substring(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) (in Sublime Text) + 12,40,... [0x10ec24fd2,0x10ec24fee,...] + 2 wildcard_imatch(std::__1::vector<parsed_pattern, std::__1::allocator<parsed_pattern> > const&, substring) (in Sublime Text) + 86,93 [0x10ec28128,0x10ec2812f]

0 Likes

#6

So I think I’ve found it: never add your whole home directory into your project while you have index going on, thats too much for sublime, it just went in a loop indexing and indexing and … and you get the picture, 12 hours later, BOOM, the whole Mac stops with sublime eating 61GB of ram and swap.

0 Likes

#7

On a general note, it might help to have a look at the settings folder_exclude_patterns and index_exclude_patterns. A lot of reports mention issues with node_modules folders being indexed.

Maybe @wbond could add that to the defaults?

3 Likes

#8

I’m noticing major slowdowns on Windows 7 with respect to indexing. I had to turn it off (“index_files”: false) to get rid of the slowdown.

Not sure how to properly use “index_exclude_patterns” for directories.

0 Likes

#9

Can you describe what you mean by slowdowns? Is the UI getting laggy? What is the predominant language of the project you are working on?

0 Likes

#10

It seems like every few seconds the indexer tries to continue indexing (even though it’s already done), and all of Sublime Text freezes for a second until the indexer realizes that it’s finished. I’ve resorted to setting “index_files” to false for now. I’m working on a very large C++ project, which Sublime Text has been able to handle very well prior to 3127.

0 Likes

#11

There weren’t any real changes to indexing that happened between build 3125 and 3127. The “reindexing” you see can be caused by any change to a file on disk.

You can use the Help > Indexing Status… menu to show a window with what the indexer is doing. This may give some more insight.

Generally you shouldn’t see indexing slow down the UI unless you have more than CPU_CORES - 1 index workers. In the situation that you have on indexer per core, you’ll have one core trying to render the UI and parse the code in your project. Depending on your OS, it may be scheduling those two sublime_text executables in a way that the indexer isn’t being given the lower priority it should. You can tweak the number of workers in your settings to see if that helps.

0 Likes

#12

Weird…I actually noticed the issue while I just let the computer sit there. Is there a way to see which files Sublime Text thinks changed?

Changing the number of workers was my first thought. I had 8 workers before, which seemed to be fine, but I changed it 4 and 0 with no difference. When you mention CPU_CORES, do you mean virtual cores or physical cores, or does it not matter?

0 Likes

#13

I don’t believe so, unless an error occurs.

I would do physical cores. If you are running a quad core machine, I wouldn’t set the workers above 3, and 2 may work better depending on what else your machine is doing, how much is being indexed and if you are using a laptop or desktop.

0 Likes

#14

Okay, thanks for the clarification. I’ll try 2 workers. Also, there are several very large directories that I really don’t need indexed, can I exclude these from the indexer?

UPDATE:
Changing to 2 workers didn’t solve the issue. There must be something going on because I’ve never had this issue until now. Is there anything else I could try?

0 Likes

#15

I have one issue with how tab scrolling is handled in the Adaptive theme on Linux. I’m used to being able to flip through tabs with the mouse wheel (saves me from clicking), and in the Adaptive theme it just scrolls the tabs without navigating to the tab. I know this is probably a GTK thing in the first place, but its one of the reasons I use Linux. (Same issue with Chrome.)

I also tried disabling enable_tab_scrolling in settings which works, but it then makes the tabs too small to be legible.

I really like the updates this year. Keep up the great work!

0 Likes

#16

Minor but I see names cut off when path is so long in adaptive theme.

0 Likes

#17

Hi,

I have some issues with using the project_data() in a plugin. What follows is a “short” repo case that I have with the output afterwards. This does not seem to happen on the latest released sublime3 build but it does happen on the dev build. Maybe I’m doing something wrong so if that’s the case I apologize, otherwise there seems to be a problem.

The issue is as follows: it seems that sometimes self.window.project_data() returns a string object instead of a dict() after I update the project data with self.window.set_project_data() (even though I make certain that a) I only do it on the main thread and b) I absolutely store a dict() object.)

code:
# repo_test.py

import sublime, sublime_plugin
import os, sys, threading
import inspect


def get_type_id_string( obj ):
    type_id_string = "id: {0}, type: {1}".format( id(obj), type(obj))
    return type_id_string


def debug_print( text ):
    callerframerecord = inspect.stack()[1]
    callerframe = callerframerecord[0]
    lineno = callerframe.f_lineno
    print( str(lineno) + ": [TID: {0}] -> ".format(threading.get_ident()) + ": {0}".format(text) )


class RepoThread( threading.Thread ):
    def __init__(self, on_finished_callback):
        threading.Thread.__init__(self)
        self.on_finished_callback = on_finished_callback

    def run( self ):
        self.item = "asdf"
        debug_print( "RepoThread.run" )

        def on_done():
            debug_print( "RepoThread.on_done" )
            self.on_finished_callback( self.item )

        sublime.set_timeout( on_done, 10 )


class RepoTestCommand(sublime_plugin.WindowCommand):
    def run(self, **kwargs):
        debug_print( "RepoTestCommand" )

        # test setup
        project_data = self.window.project_data()
        if not project_data:
            project_data = dict()
            self.window.set_project_data( project_data )
            project_data = self.window.project_data()

        project_data.pop( "settings", None )
        self.window.set_project_data( project_data )

        project_data = self.window.project_data()
        debug_print( "constructor pd: {0}".format( get_type_id_string(project_data)))

        thread = RepoThread( self.on_thread_done )
        thread.start()


    def on_thread_done( self, item ):
        project_data     = self.window.project_data()
        debug_print( "pd: way before: {0}".format( get_type_id_string(project_data)))

        project_settings = dict()
        project_data[ "settings" ] = project_settings
        debug_print( "pd: after set settings: {0}".format( get_type_id_string(project_data)))

        project_settings["solution_file"] = item
        debug_print( "pd: after update settings: {0}".format( get_type_id_string(project_data)))
        self.window.set_project_data( project_data )

        project_data     = self.window.project_data()
        debug_print( "pd: after: {0}".format( get_type_id_string(project_data)))
        project_settings = project_data[ "settings" ]

output dev build:

38: [TID: 6528] -> : RepoTestCommand
51: [TID: 6528] -> : constructor pd: id: 61734600, type: <class 'dict'>
27: [TID: 10768] -> : RepoThread.run
30: [TID: 6528] -> : RepoThread.on_done
59: [TID: 6528] -> : pd: way before: id: 61734600, type: <class 'dict'>
63: [TID: 6528] -> : pd: after set settings: id: 61734600, type: <class 'dict'>
66: [TID: 6528] -> : pd: after update settings: id: 61734600, type: <class 'dict'>
70: [TID: 6528] -> : pd: after: id: 117018256, type: <class 'str'>
Traceback (most recent call last):
  File "C:\Users\secker\AppData\Roaming\Sublime Text 3\Packages\DummyTest\dummy_test.py", line 31, in on_done
    self.on_finished_callback( self.item )
  File "C:\Users\secker\AppData\Roaming\Sublime Text 3\Packages\DummyTest\dummy_test.py", line 71, in on_thread_done
    project_settings = project_data[ "settings" ]
TypeError: string indices must be integers

output released build

38: [TID: 15100] -> : RepoTestCommand
51: [TID: 15100] -> : constructor pd: id: 57978504, type: <class 'dict'>
27: [TID: 14288] -> : RepoThread.run
30: [TID: 15100] -> : RepoThread.on_done
59: [TID: 15100] -> : pd: way before: id: 57978504, type: <class 'dict'>
63: [TID: 15100] -> : pd: after set settings: id: 57978504, type: <class 'dict'>
66: [TID: 15100] -> : pd: after update settings: id: 57978504, type: <class 'dict'>
70: [TID: 15100] -> : pd: after: id: 57978632, type: <class 'dict'>
0 Likes

#18

Where do you set self.on_thread_done? It looks to be None when you pass it to your thread object. In fact I get something completely different:

36: [TID: 140736271856576] -> : RepoTestCommand
49: [TID: 140736271856576] -> : constructor pd: id: 4543435696, type: <class 'dict'>
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 797, in run_
    return self.run()
  File "/Users/rwols/Library/Application Support/Sublime Text 3/Packages/User/RepoThread.py", line 51, in run
    thread = RepoThread( self.on_thread_done )
AttributeError: 'RepoTestCommand' object has no attribute 'on_thread_done'
0 Likes

#19

Hi,

‘on_thread_done’ is a member of ‘RepoTestCommand’ and passed to the constructor of ‘RepoThread’ at the end of ‘RepoTestCommand.run’
(just copied the code as posted into a new plugin file on a different computer and works for me… well or repos the bug i’ve described)

0 Likes

#20

Does this happen 100% of the time for you? I copied the code into a plugin on a vanilla 3131 build and it seems to work OK for me both from a window that has no project and a window that has a project associated with it. Sample below:

>>> window.run_command("repo_test")
36: [TID: -1219404960] -> : RepoTestCommand
49: [TID: -1219404960] -> : constructor pd: id: 3054240300, type: <class 'dict'>
25: [TID: -1243612304] -> : RepoThread.run
28: [TID: -1219404960] -> : RepoThread.on_done
57: [TID: -1219404960] -> : pd: way before: id: 3054240300, type: <class 'dict'>
61: [TID: -1219404960] -> : pd: after set settings: id: 3054240300, type: <class 'dict'>
64: [TID: -1219404960] -> : pd: after update settings: id: 3054240300, type: <class 'dict'>
68: [TID: -1219404960] -> : pd: after: id: 3054240044, type: <class 'dict'>
>>> sublime.version()
'3131'
0 Likes