public MemoryMapPane(UIState s, IViewPaneEventListener l, VisualElement toolbarExtension)
            : base(s, l)
        {
            CurrentTableView = (TableDisplayMode)UnityEditor.EditorPrefs.GetInt("Unity.MemoryProfilerForExtension.Editor.UI.MemoryMapPane.TableDisplayMode", (int)TableDisplayMode.Regions);

            m_ToolbarExtension     = toolbarExtension;
            m_ToolbarExtensionPane = new IMGUIContainer(new Action(OnGUIToolbarExtension));

            s.CurrentMode.ViewPaneChanged += OnViewPaneChanged;
            s.ModeChanged += OnModeChanged;

            string[] displayElements = Enum.GetNames(typeof(MemoryMap.MemoryMap.DisplayElements));
            m_DisplayElementsList = new GUIContent[displayElements.Length];
            for (int i = 0; i < displayElements.Length; ++i)
            {
                m_DisplayElementsList[i] = new GUIContent(displayElements[i]);
            }

            ulong maxSize = 256 * 1024 * 1024; //256 128  64,32,16,8,  4,2,1,512,  256,128,64,32

            m_BytesInRowList = new RowSize[14];
            for (int i = 0; i < m_BytesInRowList.Length; ++i)
            {
                m_BytesInRowList[i] = new RowSize(maxSize >> i);
            }

            m_MemoryMap = new MemoryMap.MemoryMap();
            m_MemoryMap.Setup(m_UIState.snapshotMode.snapshot);
            m_MemoryMap.RegionSelected += OnSelectRegions;
        }
        public override void OnClose()
        {
            m_MemoryMap   = null;
            m_Spreadsheet = null;

            if (m_ToolbarExtensionMode != null)
            {
                m_ToolbarExtensionMode.ViewPaneChanged -= OnViewPaneChanged;
            }
            m_ToolbarExtensionMode = null;
        }