New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anaconda high memory usage #97
Comments
Hi. The JsonServer log is empty. Btw, this is too curious because the Which version of the interpreter have you configured?
|
Hi again. I am sorry but I am afraid that I can't replicate this problem: http://bpaste.net/show/146925/ I'm marking this as "no replicable". Some tips:
Regards. |
Forget the json log (it is a pain that you can't attach file to github issues!), I have got better. I did the same experiment again: fmertens@vlb063: 14:14:54 PID minflt/s majflt/s VSZ RSS %MEM Command the big increase in memory at 14:15:16 correspond to the time I was triggering anaconda_doc for gtk at the line: import gtk Python interpreter is the default one in this system, which is python 2.7.3 My user settings: |
I just tried again using GTK and I got the same result than before. I noticed you have several extra_paths maybe there is something adding rubbish to the global namespace but if you look at the JsonServer code nothing is referenced we just instantiate a new Doc command handler that fire the needed Jedi methods and call the callback (that is self.return_back in JsonServer that just send the data back through the socket). Can you try to remove your extra paths and try again? |
Retried on an empty workspace, same result. First round: import gtk then "Anaconda > Show documentation" on 'gtk' fmertens@vlb063: 15:46:34 PID minflt/s majflt/s VSZ RSS %MEM Command 15:47:18 PID minflt/s majflt/s VSZ RSS %MEM Command I then closed sublime-text, restarted it, monitor again and asked again the doc of gtk: fmertens@vlb063: 15:46:34 PID minflt/s majflt/s VSZ RSS %MEM Command 15:47:18 PID minflt/s majflt/s VSZ RSS %MEM Command json server log for the two run: Version of pygtk (but I don't think it has anything to do with this issue)
|
Ok, lets try something else. Edit your anaconda configuration with this:
Go to $HOME/.config/sublime-text-3/Packages/Anaconda and start the JsonServer manually with:
Now restart your sublime text 3 and anaconda will now connect to the DEBUG server, hopefully we will get more information about what is happening. |
I did that on my home system which is a bit different (ubuntu 13.10, python 2.7.5), with same result.
Results: Memory monitor: 18:17:24 UID PID minflt/s majflt/s VSZ RSS %MEM Command (note that I have 6Go of RAM on my home system vs 2Go on my work system) Jsonserver log: About push back to ST3: {"doc": "No docstring for \n-------------------------------------------------------------------------------\nNo docstring for ", "uid": "8ce7bd22ecab4f3eb061cdfb8d530e8b", "success": true} About push back to ST3: {"errors": [{"regex": "(^|\s+|,\s_|as\s+)(?P[\w]gtk[\w]*)", "linematch": "(from\s+[\w.]+\s+)?import\s+(?P[^#;]+)", "level": "W", "raw_error": "'gtk' imported but unused", "pep8": false, "lineno": 1, "offset": 0, "message": "%r imported but unused"}], "uid": "727435c072834b22a40e6f707dee1b53", "success": true} About push back to ST3: {"errors": [{"regex": "(^|\s+|,\s_|as\s+)(?P[\w]gtk[\w]*)", "linematch": "(from\s+[\w.]+\s+)?import\s+(?P[^#;]+)", "level": "W", "raw_error": "'gtk' imported but unused", "pep8": false, "lineno": 1, "offset": 0, "message": "%r imported but unused"}], "uid": "1806b3baf1604f28bb27cf091dca5f7c", "success": true} About push back to ST3: {"errors": [{"regex": "(^|\s+|,\s_|as\s+)(?P[\w]gtk[\w]*)", "linematch": "(from\s+[\w.]+\s+)?import\s+(?P[^#;]+)", "level": "W", "raw_error": "'gtk' imported but unused", "pep8": false, "lineno": 1, "offset": 0, "message": "%r imported but unused"}], "uid": "2d620bd56ea044a1afb483ff55e85aaf", "success": true} |
I still can't reproduce that. Even in your case, that call to the doc function on GTK returns nothing:
In my case it returns nothing and the memory consumption remains the same. I will let you know if I am able to replicate the problem in my work machine tomorrow (Ubuntu 13.10) Regards. |
Good news @flomertens finally I reproduced it (not with this huge amount of memory of yours). Will be solved in the next commit. Thank you for your feedback this was a really hidden bug in the JsonServer. Regards. |
I have good and bad news. First the good one: There is no memory leak in anaconda When you import gtk and run any jedi related feature (autocompletion, goto, find usages, documentation), Jedi load the whole library and cache it on memory. Seems that can't be configured at all. I added a call to the Jedi clean cache library after each command is executed, it will delete any "unused" cache, seems like the impact is not too much but I see better numbers in my pidstat. The really good new is it doesn't grow more (really seems like gtk import everything in the library when you just do import gtk, that is a really bad design, PySide for instance does not have this behavior). I'm sorry to can't be more helpful here. |
I'm using Build 3061 (x86) on Windows Server 2012 R2 Datacenter. I've disabled four at the beginning (Anaconda, Trailing Spaces, Bracket Highlighter and Vintagous) and watched the plugin_host.exe in the taskmanager closely. Memory consumption wasn't increasing any more... But reenabling Anaconda let's the plugin_host begin to grow. Not every second but about every 12 seconds the process claims 300Kb more. It never stops as long Anaconda is running. So even if I don't use ST at all (but it's running in the background) the plugin_host process will consume more and more memory. It easily reaches 2GB after 24 hours. The curious thing... This happens even if there are only 3 open files (and all of them are .txt). No .php, nothing else in that direction... I'll deliver as much information as I can if you like to describe how I get them (under Windows) :) Regards, |
Hi @highend Maybe there is some memory leak on anaconda that only affects Windows cos I have running it for weeks on my Linux boxes with no problems. Let's try to get some information. Anaconda uses external process that do all the hard work. The process should be identified in Windows as a regular python.exe process, this is the process that lint autocomplete and do everything else. The plugin host should be really just doing really light stuff. Can you monitor the anaconda python process as well? Regards |
Hi @DamnWidget
Last lines
The "Persisten list" is the only one that belongs to Anaconda that looks "unusual". I get the same message on my normal installation, too. Regards |
Did you noticed the same memory drain on this portable version with just anaconda installed on it? |
Yepp, that's what I wanted to say with the second list item :) So there is definitely a memory "leak" inside Anaconda even if it's only present under a MS Windows system. Btw, whenever Anaconda allocates a new ~300KB block the process (plugin_host) activity jumps from 0,0% to 0,4-0,7%. It's doing something but I don't know what ;) Time for bed now, I'll answer any new questions in about 8 hours. |
Hi guys. I've been working on that but I am not able to replicate this problem myself, I am using Windows 7 x64 with ST3 3059 and the last version of Anaconda and my plugin_host.exe process does not grow at all. I test it with both portable and installable versions and both 32 and 64 bits. I am running Package Control and Anaconda with no more plugins. I have to be able to replicate this behaviour in order to fix it but I am not so I need more information. Is the memory usage growing in a consistent way? |
|
I have absolutely the same behavior like cloudysapa. Only ST3, only Anaconda, no Package Control or any other additional addons. ST3 has no open buffers, TaskManager in front of ST3 (no other apps are running). ST3 3061 x86 portable I've now tested it in a virtual machine: Windows 7 Enterprise, x86 de-DE I guess it wouldn't help if I record a video of it, right? |
Hi I detected some sort of memory growing on plugin_host related with the linting part of the plugin (that is in big part inherited code from Sublime Linter itself) but I am not able to replicate the memory growing with no open views. I will work on this problem until it get fixed, I will come here eventually to ask you to update anaconda version and test the bug that I can't replicate myself. Regards. |
Whenever there is an update, I'll be there to report if it changes anything... Regards, |
Hi again. I have two news, one is good and the another one is really bad. Let's start with the good one. I found the memory leak. Please, follow the following steps to confirm that I am right:
Regards |
8). You're right... About 20 MB on my system but I got the point. Will you forward the bug to jps? |
Yes, but I am investigating deeper about the problem, seems like if you run the garbage collector manually, it get collected almost all the new allocated memory but you have to collect it manually (and it doesn't collect all the memory, some kilobytes are still leaked) |
…r when objects are shared betwen threads. In the API doc of ST3 they said those _async methods are thread safe, but the objects that are created in local scopes into that functions are not being collected by the ST3 embedded python garbage collector and severe memory leaks appears much more often if your plugin is hardly based on asynchronous events (as anaconda is). This meant to solve (or at least strongly mitigate) the #97 issue
Hi guys. I just refactored critical parts of the plugin. Seems like ST3 leaks memory when the "thread safe" That affected anaconda quite seriously as the plugin is totally event driven and asynchronous, I had to modify really critical parts of the plugin that are related with the speed and performance of the linting process. I still feel the plugin much more faster than other plugins out there but we lost some speed in the process. Please, take a look at the last commit and report anything that doesn't work (I use auto-completion and linting only so I didn't tested every anaconda feature). I also tested the changes on my Linux box only so is quite possible other implementations are partially break. Let me know how you feel the plugin now. Regards. |
Yeahhhh, I confirm that the memory leak issue has been fixed. Code completion and linting work great. I'm not sure how "rename object under cursor" works. It seems not working. I tried to rename a method of a class but nothing happened. |
Rename feature never worked quite well so nevermind it |
The latest commit fixes the memory leak for me as well :) Thanks a lot, Oscar! |
I'm so happy to read this comments. I have the same issue before. |
Still |
I have found that lately anaconda jsonserver is eating memory pretty fast
I have logged the memory usage while working:
Memory usage: http://pastebin.com/XYBSHGvE
jsonserver log: http://pastebin.com/uSi7za36
Tell me if you need more information from me.
The text was updated successfully, but these errors were encountered: