Bernie wrote: > I made the changes you recommend (amended code below). I ran > MallocDebug and followed the instructions in the Debugging folder on > the CD. I get an extra leak but I'm not familiar enough with Malloc to > determine where the problem is. Any chance you could try it at your > end? 1. You are still spewing to Console.app. A MenuRef is *NOT* a handle: DisposeHandle(menuRef) 2. After removal of the offending statement above, MallocDebug shows a small leak due to ContextualMenuSelect (40 bytes per call). 3. I would write your ContextualMenuClick function like this: local fn ContextualMenuClick dim as Str255 s dim as point where dim as MenuRef menuRef dim as IconRef @ iconRef dim as IconSuiteRef @ iconSuite128Ref, iconSuite129Ref dim as long @ selectionType dim as short @ menuID, itemID dim as OSStatus ignore dim as OSErr err '~'< where.h% = mouse(_horz) where.v% = mouse(_vert) // zero the icon ref vars iconRef = 0 iconSuite128Ref = 0 iconSuite129Ref = 0 menuRef = fn NewMenu( _MyContextMenuID, "" ) long if menuRef InsertMenu( menuRef, -1 ) AppendMenu( menuRef, "Icon Ref" ) AppendMenu( menuRef, "Icon Suite 128" ) AppendMenu( menuRef, "Icon Suite 129" ) err = fn GetIconRef(_kOnAppropriateDisk, _kSystemIconsCreator, _kHelpIcon, iconRef) long if ( err == _noErr ) ignore = fn SetMenuItemIconHandle(menuRef, 1, _kMenuIconRefType, #iconRef) end if err = fn GetIconSuite(iconSuite128Ref, 128, _kSelectorAllAvailableData) long if (err == _noErr) ignore = fn SetMenuItemIconHandle(menuRef, 2, _kMenuIconSuiteType, #iconSuite128Ref) end if err = fn GetIconSuite(iconSuite129Ref, 129, _kSelectorAllAvailableData) long if (err == _noErr) ignore = fn SetMenuItemIconHandle(menuRef, 3, _kMenuIconSuiteType, #iconSuite129Ref) end if ignore = fn ContextualMenuSelect(menuRef, where, _false, _kCMHelpItemRemoveHelp, @s, #_nil, @selectionType, @menuID, @itemID) // dump everything that was created or got DisposeMenu( menuRef ) if iconRef then ignore = fn ReleaseIconRef(iconRef) if iconSuite128Ref then ignore = fn DisposeIconSuite(iconSuite128Ref, _true) if iconSuite129Ref then ignore = fn DisposeIconSuite(iconSuite129Ref, _true) end if end fn 4. MallocDebug continues to show the same small leak. This starts to look like a bug in ContextualMenuSelect, not in the code above. Robert P.