If a menu is assigned to a window and that window is destroyed, Windows automatically destroys the menu, freeing the menu's handle and the memory occupied by the menu. Windows does not automatically destroy a menu that is not assigned to a window. Your application must destroy the menu by calling the DestroyMenu function; otherwise, the menu continues to exist in memory even after your application exits.