Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Memory leak in daMetaData.TdaMetaData.GetFieldNamesFromDataSet

edited June 2003 in General

Hi,

I am using a unit called MemCheck.Pas

(http://v.mahon.free.fr/pro/freeware/memcheck/)

while developing to check for leaks.

One reported leak is,

TdaMetaData.GetFieldNamesFromDataSet.


lFields := TList.Create;

GetFieldsFromDataSet(aMetaTable, lFields);

...

lFields.Free;

But the contents of lFields are objects and are not destroyed by the TList.

The is RBuilder 6.03. I don't know if I should be patching the code
myself when I come across leaks. Will there be any updates for version
6? Should I correct the leaks and/or report them?

Best regards,

Michel

Comments

  • edited June 2003
    Hi Michel,

    Thanks for the information.

    Please send us an example of the code you are using to cause the leak and we
    will test with ReportBuilder 7.02 to see if it still exists and possibly fix
    it.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2003

    Hi Nico,

    The code is quite huge. I created DADE classes for ODBC access and
    testing on a database with more than 110 tables.

    The leak is very simple,

    In TdaMetaData.GetFieldsFromDataSet a field is created and added to the
    aList parameter:

    aFields.Add(lField);

    But since aFields is simply a TList, it does not destroy it items.


    Then in TdaMetaData.GetFieldNamesFromDataSet a list is created then
    destroyed, but the fields inside the list are not destroyed:


    lFields := TList.Create;

    GetFieldsFromDataSet(aMetaTable, lFields);
    ...
    lFields.Free;

    I can correct the leak if you want, it is just a matter of iterating
    though lFields, but I don't want to have a different code base.

    Do you want me to correct the leaks I find and send you the changes?

    If you prefer I have also attached the call stack if you prefer to look
    into this directly.

    Best regards,

    Michel

    Call stack:
    Leak #0 - 11 occurence(s) - CLASS TdaMetaField, Size: 32, allocated at
    0030A26B Module daMetaData.pas Routine
    TdaMetaData.CreateMetaFieldFromDataSetField Line 853
    TdaMetaField call stack -1 : 00309DA3 Module daMetaData.pas Routine
    TdaMetaData.GetFieldsFromDataSet Line 704
    call stack -2 : 00309EA1 Module daMetaData.pas Routine
    TdaMetaData.GetFieldNamesFromDataSet Line 731
    call stack -3 : 0030A358 Module daMetaData.pas Routine
    TdaMetaData.ValidateFieldNames Line 883
    call stack -4 : 00309C01 Module daMetaData.pas Routine
    TdaMetaData.GetFields Line 653
    call stack -5 : 00313F26 Module daSQL.pas Routine
    TdaSQL.CreateFieldsForTable Line 2714
    call stack -6 : 00313CEB Module daSQL.pas Routine
    TdaSQL.CreateAvailableFieldList Line 2621
    call stack -7 : 003196F3 Module daSQL.pas Routine
    TdaSQL.SyncFields Line 6626
    call stack -8 : 00319960 Module daSQL.pas Routine
    TdaSQL.SyncSelectFields Line 6750
    call stack -9 : 003156BD Module daSQL.pas Routine
    TdaSQL.GetAvailableSelectFieldCount Line 3787
    call stack -: : 0034DAF7 Module daQueryWizard.pas Routine
    TdaWizardFieldPage.GetAvailableChildCount Line 2106
    call stack -; : 0034C63B Module daQueryWizard.pas Routine
    TdaWizardDualListPage.SQLToControls Line 1317
    call stack -< : 0034DA37 Module daQueryWizard.pas Routine
    TdaWizardFieldPage.SQLToControls Line 2062
    call stack -= : 0034B8F4 Module daQueryWizard.pas Routine
    TdaWizardPage.Activate Line 1023
    call stack -> : 0034B4BE Module daQueryWizard.pas Routine
    TdaQueryWizardDialog.ActivatePage Line 824
    call stack -? : 0034B6C2 Module daQueryWizard.pas Routine
    TdaQueryWizardDialog.btnNextClick Line 922
    call stack -@ : 000399F4 Routine TControl.Click
    call stack -A : 00031401 Routine TButtonControl.WndProc
    call stack -B : 0003C164 Routine DoControlMsg
    call stack -C : 0004F36C (no debug info)
    call stack -D : 0003BD1B Routine TWinControl.MainWndProc
    call stack -E : 0004C782 Routine StdWndProc
    call stack -F : 77A3A240 (no debug info)
    call stack -G : 77A16B1D (no debug info)
    call stack -H : 77A24F46 (no debug info)
    call stack -I : 712F5DBD (no debug info)
    call stack -J : 712F5CDC (no debug info)


This discussion has been closed.