Home Download Buy Blog Forum Support

Page Faults

Page Faults

Postby The-Void on Wed Nov 30, 2011 6:36 pm

Tried out Sublime Text 2 Win 64 Bit (2139)
While using it i felt the system behaved a little more clogy than usual. After checking the task manager i saw that ST 2 had over 2 million page faults. (http://en.wikipedia.org/wiki/Page_fault) :geek:
Finding that quite strange i restarted ST2 and the number of page faults was quite reasonable. The instant i started scrolling a simple plain text file (also just 1 tab), the number skyrocketed. I can't think of any reason this should be normal, the only program that i got running that get close (or above) to that number is my anti-virus program and Steam.

Also, it does not only apply to scrolling. Just letting the program idle in the foreground has the same effect, but not so profound.

tl;dr
possible page fault leak in win 64 bit version of Sublime Text 2.

edit:
also happens with the 32-bit version (2139)
The-Void
 
Posts: 4
Joined: Wed Nov 30, 2011 6:20 pm

Re: Possible BUG/LEAK

Postby jps on Wed Nov 30, 2011 9:15 pm

Do you have any plugins installed?
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Possible BUG/LEAK

Postby The-Void on Thu Dec 01, 2011 3:24 pm

jps wrote:Do you have any plugins installed?

No, not that i know about. It was a fresh installation, the same day.
Also, i noticed it is also happening on my laptop (win 7 enterprise 32-bit, version 2139). I tried reverting it, same results.
The-Void
 
Posts: 4
Joined: Wed Nov 30, 2011 6:20 pm

Re: Possible BUG/LEAK

Postby The-Void on Thu Dec 01, 2011 3:42 pm

Experiment name: "ALL YOUR PAGE FAULTS ARE BELONG TO SUBLIME TEXT 2"
requirement: Windows 7, Sublime Text 2 (2139)

How to show "Page Faults" in task managers processes tab:
a. Start task manager.
b. Got to processes tab.
c. In the menu bar, "view" -> "select columns...".
d. Enable the "Page Faults" option.
e. Done.

Procedure:
1. Start task manager.
2. Start Sublime Text 2.
3. Observe the numbers of "Page Faults" for Sublime Text 2.
4. Do something in Sublime Text 2. Example: write, select and/or delete some text.
5. Observe again.
6. Do point 4-5 over some times.
7. Tell about the result
The-Void
 
Posts: 4
Joined: Wed Nov 30, 2011 6:20 pm

Re: Possible BUG/LEAK

Postby jps on Fri Dec 02, 2011 12:11 am

Page Faults in and of themselves aren't a helpful metric, and don't generally indicate bugs or memory leaks. I'd only be concerned about a large value for Private Bytes, or sluggish user-perceived responsiveness.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Possible BUG/LEAK

Postby The-Void on Fri Dec 02, 2011 12:19 am

jps wrote:Page Faults in and of themselves aren't a helpful metric, and don't generally indicate bugs or memory leaks. I'd only be concerned about a large value for Private Bytes, or sluggish user-perceived responsiveness.


Why i said i could be a possible leak, i don't know if this behavior is intentional or not. Besides it is quite a rampant increase for using basic functions of the software, i found it strange.
The-Void
 
Posts: 4
Joined: Wed Nov 30, 2011 6:20 pm

Re: Page Faults

Postby jps on Fri Dec 02, 2011 12:44 am

In general, any use of large temporary memory allocations will result in page faults. Large memory mallocs / frees will result in 1:1 calls to VitualAlloc/VirtualFree, whereas small memory allocations are coalesced. Memory returned from VirtualAlloc will cause a page fault whenever each page in touched for the first time: initially each page memory is simply added to the virtual address space, but has no physical memory backing it until the page fault is triggered.

Although I haven't looked into it in detail, I'd guess a source of the larger number of page faults you see in Sublime Text comes from the drawing code. Whenever a window is redrawn, a temporary buffer the size of the window is allocated (for double-buffered drawing), which due to its size will usually be allocated via VirtualAlloc (as opposed to using memory in the unallocated portion of the heap), and so will trigger page faults when accessed. The flip side of this is that you get flicker free drawing on Windows, which is not typical of the platform.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Page Faults

Postby wuub on Fri Dec 02, 2011 3:04 pm

jps wrote:I'd guess a source of the larger number of page faults you see in Sublime Text comes from the drawing code


+1.

Similar (or higher) number Page Faults can be observed in other render-heavy applications: Opera (doing pretty much anything), Thunderbird (list scrolling).
SublimeREPL via Package Control & SublimePTY dev/pre-alpha. Donations are appreciated, but not required :) Twitter: @wuub
wuub
 
Posts: 218
Joined: Wed Aug 10, 2011 8:16 am
Location: Poland


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 16 guests