7

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 life 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

Mitch
  • 1,173
  • 1
  • 10
  • 15
  • I'd start to look at menus you create in code yourself. Maybe the creation of right click menus in an `onchange` event or something like it overwriting another of your menu's. I've had leaks with syncfusion Edit in the past and while solving them it seemed it was pretty strict about disposing properly. – Jan-Peter Vos Jun 03 '11 at 18:46

1 Answers1

1

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