XP
(1)
EMVP
(1)
CreateEvent
(1)
OpenEvent
(1)
YPB.eto
(1)
Closehandle
(1)
Donot
(1)
Hypertminal
(1)

Handles under CE6.0R2

Asked By Rob
20-Nov-09 09:45 AM
Hi,
one of our applications seems to be running out of handles under CE6.0R2.
From Handle.c (kernel) we get : ">>>>> Completely Out Of Handles <<<<<\r\n"

Questions:
- Is there an API or other way to get the currently used (of total
available) handles for the process ?, I did not find one sofar....

- The same application under XP does NOT consume too much handles (just 100
or so), is this a known issue/difference ?

Kind Regards,
Rob.
www.robtso.nl

No such API that I am familiar with; the expectation would be that you do

Dean Ramsier replied to Rob
20-Nov-09 04:10 PM
No such API that I am familiar with; the expectation would be that you do not
run out of handles.  How many handles do you expect to be using? 100?

Are you possibly creating transient objects and not closing the handle when
done with them?

--
Dean Ramsier - eMVP
BSQUARE Corporation

Our software needs about 120 handles normally.

Rob replied to Dean Ramsier
21-Nov-09 02:30 PM
Our software needs about 120 handles normally.
Even that number is quite high i think (threads,fonts,brushes,windows etc...).
We are still searching for the cause of the handles running out.

One thing I tried is to put a retailmsg in handle.c, where the "completely
out of handles" error is given, and run a release version booting it from PB.
The handles seem to be given out in some 2-stage structure which i havent
quite figured out yet, but it looks like there are 127 * 512 handles to be
used, is that right ? (1st stage counter goes from 512 to zero, then back to
512 and the second-stage counter is decreased)

Are there any known HANDLE-API's that require Closehandle under CE, but
Donot require that nunder XP ? (so a difference in handle-behaviour CE/XP)

Kind regards,
Rob.
www.robtso.nl

...).yPB.eto)on'twhen0R2.

mike replied to Rob
02-Dec-09 07:34 PM
...).
y
PB.
e
to
)
on't
when
0R2.
st

---------------------------------------------------------------------------=
-----------
Hello Rob,

You are create too many handles, but never release them. So, in your
app, you may call "CreateEvent" "OpenEvent", and open GDI graphic that
requires open handle. When you are done, you need to call CloseHandle
(...) to close it out. You do have handle leakage even you are using
C# and manage codes.

To debug this, you need to sprinkles RETAILMSG or debug inside your
app. Using hypertminal, you can log debug messages. Run your
application over night, then you may see execution patterns. You then
narrow down your bad codes.

Good luck debugging. I done this before and it not fun.

Mike
http://www.itxembedded.com
Post Question To EggHeadCafe