Just upgraded to tmate2 (2.0-alpha.9529+macports.git.9f177d3) and noticed extremely high memory usage and slowdowns on Mavericks 10.9.2 on a Macbook Pro with 4GB RAM. I have tried resetting to defaults by deleting all the setting files/caches and the problem persists. After I open a large (66 MB, ~600K lines) tab delimited file, the memory usage goes up to 1.4 GB of real memory usage. Even after I close the window, the real memory usage is 800-900 MB although the memory usage falls to ~400 MB. If I open the same file again, the real memory usage goes up to 1.7 GB.
The starting memory usage of textmate is ~40 MB. I can quit textmate and restart and the problem is reproducible.
For comparison, opening the same 66 MB file in vim, the total memory usage is only 80 MB. The expected behaviors for textmate are the following: 1) Memory usage should be in the ballpark of starting footprint (40 MB) + file (66 MB) = 106 MB. 2) After closing the window/file, memory footprint should go back to near starting footprint (40 MB) 3) Closing and reopening a file should not increase memory footprint further.
Peter
On 6 Apr 2014, at 11:01, Peter Kim wrote:
- Memory usage should be in the ballpark of starting footprint (40
MB) + file (66 MB) = 106 MB.
This is not possible because TM associates scopes with everything in your document and it also needs to create CoreText line objects to render the text (which is too slow to do ad-hoc so these are cached).
It will probably need 10-20 extra bytes per character in your document, which turns 66 MB into ~1 GB, add in memory fragmentation and data structure alignment requirements, and you probably have your 1.4 GB.
Maybe it can be improved, maybe there is the need for a special (limited) mode for large files, but it’s not currently a priority.
- After closing the window/file, memory footprint should go back to
near starting footprint (40 MB)
How do you measure this? The malloc allocator does not give pages back to the OS (AFAIK), so once a process has increased its number of allocated pages, the count does not go down again.
- Closing and reopening a file should not increase memory footprint
further.
This might be due to fragmentation. Here one solution could be a custom memory allocator to keep everything related to a document allocated from the same memory pool, but there are still many other things I would like to do, before I look into such optimizations.
On Apr 5, 2014, at 9:01 PM, Peter Kim pjkim00@gmail.com wrote:
Just upgraded to tmate2 (2.0-alpha.9529+macports.git.9f177d3) and noticed extremely high memory usage and slowdowns on Mavericks 10.9.2 on a Macbook Pro with 4GB RAM
I would have to argue with this one: it's wrong on the facts and wrong on the law, as they like to say on TV. I live in TM2 all day every day.
TM2 starts up instantly, opens and formats documents very quickly, and is in every way lightweight and sprightly. I don't like the juddering when scrolling up, but that's a known issue. On my machine it uses so little CPU while sitting there with big formatted documents open that it doesn't even show up on Activity Monitor's first screenful (when ordered by CPU percentage).
Contrast BBEdit, which takes forever to launch, and constantly eats CPU percentage (and is 32bit).
Or Xcode, which brings a 4GB machine to its knees in short order.
You may be seeing slowdowns - Mavericks does a lot of SPODding while apparently idle on my machine - but I would contend that TextMate has nothing whatever to do with this, and that you should refine your testing procedure. Also, disable all unneeded bundles, perhaps; a badly written bundle can cause SPODs and even crashing. m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html