1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Memory / Handle Leak in TCserver and TabTip

Discussion in 'Tablet PC' started by Dino, Jan 24, 2005.

  1. Dino

    Dino Guest

    Hello people,

    I've recently found out that TCserver & TabTip have been hoarding memory on
    my machine; I also found out that it is not a new issue.

    What I do have to add to this topic is what I've noticed when checking the
    status of these two processes with Task Manager, and Process Explorer. After
    having my laptop running non-stop for many days, the memory usage of TCserver
    went over 320MB; in Task Manager I noticed that it had more than 400 thousand
    handles open!! Using process explorer I found out that the bulk of those
    handles are of the Thread type, while the actual running threads - according
    to Task Manager - was around 100.
    In this newsgroup I've stumbled upon another thread that had a link to an
    interesting article
    (http://blogs.msdn.com/jonathanh/archive/2004/08/29/222543.aspx), which
    pointed out that these two are dot NET applications; having experience with
    another "managed" language (Java), this seems to me like someone is still
    keepin referencing .NET Thread objects, which in turn probably contain Win32
    Thread handles. Having noticed that the number of active threads in TCserver
    fluctuates, as applications are run & terminated, then it must be spawning
    new threads as needed; I can definetly see a scenario in which Thread objects
    are placed in a link list, and then forgotten.

    Additionally, the primary applications I've been using during that time were
    Firefox, Thunderbird, and mplayer2; no inking at all.
    I didn't check that status of TabTip as thoroughly as TCserver, but I do
    remember that it was using a healthy chunk of memory. For next time check
    both, as well the .NET counters mentioned in the article above.

    Finally, since I marked this as a question - is Microsoft doing anything
    about this? In the other two posts I stumbled upon, a MVP mentioned that this
    will not be fixed; is this true? This is definetly a leak, which leads to an
    unuasble machine; and asking the user to restart those two processes seems
    like unacceptable. Can someone with contacts at Microsoft get this info about
    the Handles to them?

    Thanks.
     
    Dino, Jan 24, 2005
    #1
    1. Advertisements

  2. Dino

    Chris H. Guest

    Yes, those are part of managed code. Dino. As such, that is the way it is
    currently, as you noted from the blog information from August, 2004. As I
    understand it, until there's a complete revision (Longhorn timeframe,
    possibly) this is the way it is.

    I think it is important to understand, though, as pointed out in the blog,
    that the amount of "memory" you're seeing is listed the way the NT handles
    memory-mapped files - they are "committed memory" not actual memory or
    pagefile space in use.
     
    Chris H., Jan 24, 2005
    #2
    1. Advertisements

  3. Dino

    Bart Guest

    I also have the problem discribed a few times a day.

    My tablet (HP TC1100) hangs and I can't do anything with it anymore.

    I found a workaround on
    http://www.tabletpcbuzz.com/forum/topic.asp?TOPIC_ID=12577&whichpage=2

    ---- CLEARINK.BAT ----
    REM - First, kill processes
    taskkill -im tabtip.exe /F
    taskkill -im tcserver.exe /F

    REM - switch to directory containing Ink executables
    c:
    cd "C:\Program Files\Common Files\Microsoft Shared\Ink\"

    REM - Startup the processes -
    REM - tcserver.exe will be called automatically by tabtip.exe
    tabtip.exe

    ---- END OF FILE ----

    I however hope this problem will be fixed soon...
     
    Bart, Jan 24, 2005
    #3
  4. I've seen the "explanation" from someone at Microsoft as to why it
    doesn't need to be fixed, but frankly it doesn't hold water for me. When
    these processes get over 100MB of RAM, my machine becomes almost unusable.

    As a result, I run this batch file once per week (thanks to the person
    who posted this before - it's a godsend). Machine performance is
    instantly restored.

    ****************************
    REM - First, kill processes
    taskkill -im tabtip.exe /F
    taskkill -im tcserver.exe /F

    REM - switch to directory containing Ink executables
    c:
    cd "C:\Program Files\Common Files\Microsoft Shared\Ink\"

    REM - Startup the processes -
    REM - tcserver.exe will be called automatically by tabtip.exe
    tabtip.exe
    ******************************

    Mike
     
    Mike Williams [MVP], Jan 24, 2005
    #4
  5. Dino

    Dino Guest

    After around 24 hours, my tcserver.exe process has 8,540 handles, and 16
    operating system threads. According to the .Net info from Process Explorer:
    # of current logical Threads: 1,239
    # of current physical Threads: 907
    # of current recognized threads: 336
    # of total recognized threads: 1,078

    Furthermore, the GC information says:
    # Gen 0 Collections: 134
    # Gen 1 Collections: 34
    # Gen 2 Collections: 8

    I wrote a small program program to understand how these number play out, and
    the thing that baffles me is the fact that the # of physical threads does not
    correspond to the number of operating system threads (16) with the
    tcserver.exe.
    In my test program, I create C# Thread objects, that do nothing but sleep
    forever; the stats on it show a 1-to-1 correspondence between the physical
    threads and operating system threads.

    Now about the handles - in my program, when I modify the code so that the
    created C# threads to finish immediately, then the operating system's threads
    handles are released, whether or not the C# Thread object is garbage
    collected; this is obviously not the case with tcserver, meaning that the
    logical (C#) threads are still active, and maintain all their resources. I
    eyeballed the list of handles in Process Explorer, and I can say with some
    degree of confidence that the number of logical threads (1,239) corresponds
    to the number of Thread handles; there are plenty of other handles there,
    probably used in some way by the logical threads.

    Finally, a comment about garbage collection - as the numbers from Process
    Explorer demonstrate, tcserver.exe went through 8 collections in Generation
    #2; that means it had alraedy gone through 8 full grabage collections, so if
    any of those threads were truly garbage, then they would've been collected
    already. The notion that managed code will increase in size as long as there
    is space strikes me as wrong; Sun's Java VM the default initial & maximum
    heap sizes are conservative, and additional memory is allocated only after
    full garbage collections do not reduce the amount of used memory under a
    certain threshold. Naturally, all these parameters are adjustable.
    What I'm trying to get at, is that the .NET VM cannot be radically
    different, and is evident by the small memory footprint of the TCserver upon
    restart. A process that starts as 10M and ends up at over 300M, while
    apparently doing nothing - that is definetly a memory leak.

    I don't about you, but I think this is a problem that needs to be addressed
    before longhorn. It would be great if you could forward my "findings" to
    Microsoft (seeing as you are an MVP, you can get a hold of them quicker than
    I can). I'm sure that if they had a developer on this, he/she would have
    realized this by now.

    About the committed memory & handles - as far as I know, committed memory,
    is memory that has space reserved for it in the swap file, i.e. actual memory
    allocated; this is to be contrasted with reserved memory, which is only
    virtual.
    I might be a bit off on the definitions, but fact is that when Task Manager
    indicates that TCserver has a 300M+ memory usage, then my laptop is quite
    slow.
     
    Dino, Jan 25, 2005
    #5
  6. Dino

    Chris H. Guest

    As I said before, Dino, what you're seeing is not actually use of RAM or the
    Pagefile. I'm not enough of a techie to explain it, but that is as
    described in the blog URL I posted. I will try passing word along, though.
     
    Chris H., Jan 25, 2005
    #6
  7. Dino

    Dino Guest

    I'm not trying to start a flame war here :)
    But, I think there is a difference between what the .NET Runtime considers
    as reserved, and what the operating systems considers as reserved.
    When I try to figure out how much memory a process uses, I don't really care
    what the .NET numbers are, since they will be included in what the OS has to
    say about the process as a whole.
    So, at this very moment my TCserver has a Memory Usage of 37M, and a Virtual
    Memory Size of 33M; the latter must be wrong, but more on that in a moment.
    According to Task Manager's Help, the Memory Usage is "... the current
    working set of a process, in kilobytes. The current working set of a process
    is the number of pages currently resident in memory."
    Process Explorer give the same value for Memory Usage / Working Set, while
    the VM size is at 127M. This value for the VM size makes sense, so I wouldn't
    trust Task Manager's VM values.
    So, both programs say that the process is using 37M of physical/actual/real
    memory, and I believe it. When TCserver Mem Usage was 300M+ on my 1GB tablet,
    believe me, it was definetly used/committed.

    So, to reiterate - the actual memory used is displayed by Task Manager in
    the Memory Usage column, and the Working Set column in Process Explorer. In
    order to check the Virutal Memory size, use Process Explorer.

    Perhaps you can pass along the word that Task Manager is displaying the
    wrong number for the VM Size?

    Thanks.
     
    Dino, Jan 25, 2005
    #7
  8. Dino

    Chris H. Guest

    I have passed along the information, Dino.
     
    Chris H., Jan 25, 2005
    #8
  9. Dino

    Dino Guest

    Cool!
    Thanks.
     
    Dino, Jan 25, 2005
    #9
  10. Umm... no "explanation" whatsoever holds water, unless
    it's simply that too few users experience this problem. I
    just discovered it myself. Seven thousand kernel threads
    in TCServer? Yeah. No wonder my mouse pointer was jerking
    around like a drunkard.

    --Micah
     
    Micah Brodsky, Jan 27, 2005
    #10
  11. Dino

    Chris H. Guest

    Which Tablet PC do you have, are you running XP SP2 and the Tablet PC
    Edition 2005? If so, have you upgraded your drivers, especially graphics
    and pen, since installing the above? How much RAM do you have?
     
    Chris H., Jan 27, 2005
    #11
  12. Dino

    Jason Matte Guest

    I have the simplest solution for all of you.
    If you would open your mind and listen you may just be surprised at the
    results.
    Get a Mac. It works. It really does.
    It doesn't crash. It doesn't have memory leaks. It is NOT prone to viruses,
    spyware, malware, trojans, keyloggers, oh...did I mention viruses?

    My uptime on my Powerbook 17 inch is currently sitting at 4 months!!!! I
    have not powered it off once in 4 months!!!!!!!!!

    Try that in Windows.

    Good luck.

    Follow my advice and you can stop wasting time posting crap like this that
    NO ONE CARES about.

    Jason
     
    Jason Matte, Jan 29, 2005
    #12
  13. Dino

    Dino Guest

    I wonder if I mentioned in my other messages in this thread, so here it is:
    Acer C300, with 1GB RAM; I applied SP2, hence I have the 2005 Edition. My
    drivers are up to date, although I fail to see how it could be related to the
    leak.

    I'm guessing that other people didn't notice it because they probably
    shutdown the machine most of the time; either that, or that they are the
    "common user" which doesn't have a clue on what's going on, and simply
    reboots, and everything is back to normal....
     
    Dino, Jan 31, 2005
    #13
  14. Dino

    Woody Guest

    I have 4 macs. How does that help a memory leak in my TIP?
    I think you will find that in a tablet PC group, that is probably what
    you appear to be doing.
    I love my Macs, I post about them in the Mac groups. It is more
    constructive that way.
     
    Woody, Jan 31, 2005
    #14
  15. Dino

    Woody Guest

    So does anyone know the reasons that some do it and some don;t? I
    haven't seen this on my TC1100, and I use it extensively
     
    Woody, Jan 31, 2005
    #15
  16. Dino

    Woody Guest

    A driver has a lot to do with the potential for leaks I would have
    thought.
    Speaking as one of these 'common users', a Software engineer building
    distributed network documentation systems, My tablet was last rebooted
    on tuesday, and has been used quite a lot in the 5 days since then. My
    tabtp is at 24M (admitadly too high) with 19 threads.

    I have never seen this problem that a small number of people are
    describing so I was wondering what combination of factors causes it.
     
    Woody, Jan 31, 2005
    #16
  17. AFAICT from official responses, the Tablet team have decided that it's a
    non-issue and are no longer investigating :-(.
     
    Mike Williams [MVP], Jan 31, 2005
    #17
  18. Dino

    Woody Guest

    That is clearly wrong then. It appears it is a problem for some people,
    and with it splashed over the register, I would have thought it was an
    issue for the tabletPC team in general.
     
    Woody, Jan 31, 2005
    #18
  19. Dino

    Woody Guest

    Woody, Jan 31, 2005
    #19
  20. Dino

    Chris H. Guest

    As I posted six days ago, I passed the information along (again) and the
    Tablet Team at Microsoft is looking into it.
     
    Chris H., Jan 31, 2005
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.