开发者

How to find a leak in User Objects

Our .Net 4.0 application has a leak that causes it to crash after extended use. Upon investigation I determined that "User Objects" were leaking. A User object is a windows resource as described here:

http://msdn.microsoft.com/en-us/library/ms725486%28v=VS.85%29.aspx

Windows allocates 10,000 user objects per process. Other windows resources such as GDI objects and Handles are constant while the app is running.

I found a similar question for C++, where the solution required downloading a package called "detours" from microsoft reseach - the catch? $10K.

Using Ant memory profiler, I SUSPECT, it has to do with menus. We're using menus from SyncFusion, so the li开发者_如何学JAVAfe cycle of stuff related to menus can not be found by looking in the code. So this may be a bug SynFusion must solve.

Anyone have a similar leak using SyncFusion menus? Ants tells me that some PopupMenu objects are sticking around, but Ants does not give info on how to find where the objects are created (and thus determine where to Dispose them).

The leakTrap/detours mentioned in the above referenced SO post looks interesting because it seemed to trap the specific calls to the USER object allocation.

Suggestions are welcomed


if you know menus are hanging around you should be able to enumerate GDI objects for your process and nurf them with DeleteMenu().

windows should notify your parent window when popup menus are displayed and closed so that would be the perfect place to take snapshots of GDI menu handles and delete the newer one.

its pretty brute force and not recommended for .net where doing this sort of low-level GDI manipulation is perhaps naughty

i would make a simple test app with SyncFusion menus to prove the point and if the problem persists contact the vendor

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜