Technology Questions

Go Back   Technology Questions > Hardware Questions > Mobile Computers > Tablet PC > Tablet PC Software > Tablet PC Developers

Tablet PC Developers Show off your work while discussing with others how to create ink enabled applications.

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 05-06-2007, 07:30 AM
Kendal Goodrich
Newsgroup Contributor
 
Posts: n/a
Re: InkOverlay

Okay, here we go:
My Ink Version = 1.7.2600.2180
My Net Version that VS is running on is Net Framework 1.1 Version 1.1.4322
SP1
OS is XP Pro
I am running all of this on a desktop machine.

Here is what I did, I created a main form with a button that opens form 2.
All form 2 does is has a instance of InkOverlay declared but not
instantiated. In Form 2 onload, it instantiates the InkOverlay(oink = new
InkOverlay). When Form 2 opens, my handle count goes up by 10. On form 2 I
also created a button to test some dispose code. If I close the form
without hitting the dispose button, my handle count does not go down. If I
code the dispose button to ONLY dispose the ink overlay object, my handle
count goes down by 5. If I code the dispose button to dispose the ink
overlay object AND GC, it will recover the full 10, but if I do not
GC.Collect directly after disposing the ink overlay object, the handles will
not be recovered. For instance, if I open form2, ink overlay is
instantiated, handles +10, then close form 2, then open form 2 again which
increases handles +10 again for a total of +20 handles, then dispose and
call GC.Collect, the handles only decrease by 10 and not the full 20.

Please let me know what you come up with and what you think.

Thanks,
Kendal


"Stefan Wick[MS]" <StefanWickMS@discussions.microsoft.com> wrote in message
news:BB98BE8E-46C0-4962-87DC-7E4ADE75493B@microsoft.com...
> Hi Kendal,
>
> sorry for the delayed reply.
>
> Did you verify that the handle count does not go down to normal once the
> CLR
> garbage collection kicks in?
>
> I tried to reproduce the problem on my TabletPC with the folloiwng simple
> control:
>
> class InkTextBox : RichTextBox
> {
> private InkOverlay _inkOverlay;
>
> public InkTextBox()
> {
> _inkOverlay = new InkOverlay(this);
> _inkOverlay.Enabled = true;
> }
>
> protected override void Dispose(bool disposing)
> {
> _inkOverlay.Dispose();
> base.Dispose(disposing);
> }
> }
>
> When I add/remove/dispose a bunch of those controls in an app, I see that
> the handle count temporarily goes up, but it goes down to normal once
> garbage
> collection kicks in.
>
> You can force garbage collection in your app by doing the below to calls
> to
> verify whether it is just the pending garbage collection that holds on
> temporarily to those handles:
>
> GC.Collect();
> GC.WaitForPendingFinalizers();
>
> If the handles are indeed being leaked in your app, please post again with
> the following information:
> - what version of Microsoft.Ink are you using?
> - what version of the .NET Framework are you using?
> - what version of the operating system are you using?
>
> Also a simplified code snippet of your control/app would be helpful.
>
> Thanks,
> Stefan Wick
>
>
> "Kendal Goodrich" wrote:
>
>> I guess nobody can help or have suggestions about this post.
>>
>>
>> "Kendal Goodrich" <kgoodrich@jeffersonmedical.net> wrote in message
>> news:%239Mcn7fHHHA.1784@TK2MSFTNGP06.phx.gbl...
>> >I have a situation in which I am using InkOverlay and it appears to be
>> >causing a problem. I am using the InkOverlay class in a custom
>> >RichTextBox. The application this control is used with is run on a
>> >desktop
>> >PC and a Tablet PC. The desktop PCs have the Tablet SDK installed so as
>> >not to crash while running the application. My problem comes in when a
>> >form is shown that contains the custom richtextbox that implements
>> >InkOverlay. When the form is shown, my handle count(viewable through
>> >windows task manager) goes up by 10. In the custom richtextbox's
>> >dispose
>> >method, I specifically dispose the InkOverlay object. When the form is
>> >closed and the richtextbox is disposed, my handle count only drops by 5.
>> >So when I open and close a form that contains the richtextbox,
>> >ultimately
>> >my handle count increases by 5 every time. If I comment out the one
>> >line
>> >of code in my richtextbox constructor that says "oink = new
>> >InkOverlay();",
>> >my handle count does not increase at all when the form is shown....so I
>> >know the problem is in InkOverlay. Can anyone give me some insight as
>> >to
>> >how to deal with this problem?????
>> >
>> > Thanks,
>> > --
>> > Kendal Goodrich
>> >
>> >

>>
>>
>>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 05-06-2007, 07:30 AM
  #2 (permalink)  
Old 05-06-2007, 07:31 AM
Stefan Wick[MS]
Newsgroup Contributor
 
Posts: n/a
Re: InkOverlay

Hi Kendal

sorry for the late reply - I somehow missed your last post.

> If I code the dispose button to dispose the ink
> overlay object AND GC, it will recover the full 10, but if I do not
> GC.Collect directly after disposing the ink overlay object, the handles will
> not be recovered.


So then it seems there isn't actually a resource leak here. All resources
apparently are marked properly as eligible for garbage collection.
GC.Collect() collects them - and without calling GC.Collect() they will be
collected eventually once the automatic garbage collection kicks in.

The rules to determine when garbage collection kick in are pretty complex
and depend on time and resource pressure (among other things). So if your
system still has plenty resources, garbage collection does not immediately
collect those handles. It will collect them at later time or when a certain
threshold of resource usage is reached.

Adding a GC.Collect() temporarily for testing purposes helps to determine if
a growth in resource usage is an actual leak or simply due to the fact that
garbage collection did not yet kick in.

Another test you could do is repeat your scenario many times until you see
garbage collection kicking in. If the growth of the resource usage is unbound
then it is leak.

Thanks,
Stefan Wick
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
InkOverlay and Word Matt Ray Tablet PC Developers 3 07-25-2007 03:20 PM
Newbie question: How to set InkOverlay.Enabled = false, without throwing any exceptions Christian Stapfer Tablet PC Developers 3 06-27-2007 09:50 PM
Transparent Form, Solid InkOverlay? Alz Tablet PC Developers 1 06-18-2007 09:31 PM
Scrolling innacurate after scaling the InkOverlay Steve Niles Windows XP Tablet PC Newsgroup 3 12-03-2006 11:37 AM
InkOverlay Handle Leak? JasonG Windows XP Tablet PC Newsgroup 3 02-22-2005 08:16 AM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 05:36 PM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0