Memory leaks with ORM after inserting records

Home Forums kbmMW Memory leaks with ORM after inserting records

This topic contains 3 replies, has 3 voices, and was last updated by  Francisco Armando Dueñas Rodriguez 3 weeks, 6 days ago.

  • Author
    Posts
  • #54145

    Francisco Armando Dueñas Rodriguez
    Participant

    Hi using the ORM stand alone demo (Demo\ORM\Standalone), after inserting the record by clicking on ‘Add records’, if I close the applicatiosn it throws me some memory leaks:

    —————————
    Unexpected Memory Leak
    —————————
    An unexpected memory leak has occurred. The unexpected small block leaks are:

    1 – 12 bytes: Unknown x 6

    13 – 20 bytes: UnicodeString x 6

    29 – 36 bytes: TValueDataImpl x 6

    37 – 44 bytes: UnicodeString x 2

    45 – 52 bytes: TAccount x 3, TkbmMWAutoValue x 6, UnicodeString x 1

    77 – 84 bytes: UnicodeString x 5

    —————————
    OK
    —————————

    Also I have observed a silent exception that says ‘Modify failed’, after calling the ‘add records’, maybe that can be causing thos memory leaks.

    Running Delphi XE 10.3.1 and kbmMw 5.09.00

  • #54147

    kimbomadsen
    Keymaster

    Hi,

    It is a plain leak in the demo. In btnAddRecordsClick (the Add records button), a1 is instantiated multiple times. The demo only free’s the last one of them.

    Ive updated the demo to correctly free the 3 previously allocated instances, and only leave one to be freed by the form destructor.

    The internal modify failed exception happens because we use Persist. Persist will attempt to update first, and if failed, will attempt to insert. It is as designed.

     

  • #54149

    mrluigi2017
    Participant

    It seem that in the destructor all the objects used in the add record method a freed, but that is not the case. For instance a1 is used as a reference for 3 different objects and only 1 of them is freed in the destructor.

     

  • #54151

    Francisco Armando Dueñas Rodriguez
    Participant

    Thanks Kim and MrLuigi, yes maybe thats why my confuse. I thought all where freed. So seems all ok with ORM engine.

You must be logged in to reply to this topic.