TListbox TStyleobject not freed

Viewed 62

I have a cash register application using tlistbox to display receipt items. I have suspicious live memory growing problem , i tried to find what could cause this problem and discover that listbox after endupdate call TFmxObject.clone which create a TStyleObject never deleted until TlistBox itself is detroyed .... So memory increase receipt after receipt.

Does anyone have a solution or at least a workaround ?

Thanks

In order to see it i scan the Childrens list of TlistBox ...

a) Fill a listbox with 2 TListBoxItem b) click on each item ( Problem only occurs at selection )

below the children list

ListBox1:TListBox 1332 (Form181:TForm181)
{
  :TLayout 908 (:)
  {
    :TBrushObject 140 (:TLayout)
    :TStyleObject 948 (:TLayout)
    {
      :TLayout 908 (:TLayout)
      {
        :TStyleObject 948 (:TLayout)
        :TStyleObject 948 (:)
        :TStyleObject 948 (:)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
      }
      :TScrollBar 988 (:TLayout)
      :TScrollBar 988 (:TLayout)
      :TLayout 908 (:TLayout)
      {
        :TSmallScrollBar 988 (:TLayout)
        :TSmallScrollBar 988 (:TLayout)
      }
      :TLayout 908 (:TLayout)
      :TLayout 908 (:TLayout)
    }
  }
  :TListBoxContent 940 (ListBox1:TListBox)
  {
    :TListBoxItem 1052 (ListBox1:TListBox)
    {
      :TLayout 908 (:)
      {
        :TGlyph 932 (:TLayout)
        :TActiveStyleTextObject 996 (:TLayout)
        :TCheckBox 1052 (:TLayout)
        :TLayout 908 (:TLayout)
        {
          :TActiveStyleObject 980 (:TLayout)
        }
        :TLayout 908 (:TLayout)
        {
          :TActiveStyleObject 980 (:TLayout)
        }
        :TLayout 908 (:TLayout)
        {
          :TActiveStyleObject 980 (:TLayout)
        }
      }
    }
    :TListBoxItem 1052 (ListBox1:TListBox)
    {
      :TLayout 908 (:)
      {
        :TGlyph 932 (:TLayout)
        :TActiveStyleTextObject 996 (:TLayout)
        :TCheckBox 1052 (:TLayout)
        :TLayout 908 (:TLayout)
        {
          :TActiveStyleObject 980 (:TLayout)
        }
        :TLayout 908 (:TLayout)
        {
          :TActiveStyleObject 980 (:TLayout)
        }
        :TLayout 908 (:TLayout)
        {
          :TActiveStyleObject 980 (:TLayout)
        }
      }
    }
  }
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
}

Then Clear listbox if i rescan the childrens

ListBox1:TListBox 1332 (Form181:TForm181)
{
  :TLayout 908 (:)
  {
    :TBrushObject 140 (:TLayout)
    :TStyleObject 948 (:TLayout)
    {
      :TLayout 908 (:TLayout)
      {
        :TStyleObject 948 (:TLayout)
        :TStyleObject 948 (:)
        :TStyleObject 948 (:)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
      }
      :TScrollBar 988 (:TLayout)
      :TScrollBar 988 (:TLayout)
      :TLayout 908 (:TLayout)
      {
        :TSmallScrollBar 988 (:TLayout)
        :TSmallScrollBar 988 (:TLayout)
      }
      :TLayout 908 (:TLayout)
      :TLayout 908 (:TLayout)
    }
  }
  :TListBoxContent 940 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
}

Load again 2 items and clear

ListBox1:TListBox 1332 (Form181:TForm181)
{
  :TLayout 908 (:)
  {
    :TBrushObject 140 (:TLayout)
    :TStyleObject 948 (:TLayout)
    {
      :TLayout 908 (:TLayout)
      {
        :TStyleObject 948 (:TLayout)
        :TStyleObject 948 (:)
        :TStyleObject 948 (:)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
        :TStyleObject 948 (ListBox1:TListBox)
      }
      :TScrollBar 988 (:TLayout)
      :TScrollBar 988 (:TLayout)
      :TLayout 908 (:TLayout)
      {
        :TSmallScrollBar 988 (:TLayout)
        :TSmallScrollBar 988 (:TLayout)
      }
      :TLayout 908 (:TLayout)
      :TLayout 908 (:TLayout)
    }
  }
  :TListBoxContent 940 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
  :TContent 916 (ListBox1:TListBox)
}

The only solution i found is to delete the listbox and recreate it instead of clearing it...

0 Answers
Related