CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Memory leaks

  1. #1
    Join Date
    May 1999
    Posts
    3

    Memory leaks

    Hi,

    I'm sorting a ListCtrl. I'm setting Item Data for the CALLBACK compare function like this:

    CItemInfo *pItemInfo = new CItemInfo();
    pItemInfo->SetLabel(strLabel);
    m_ctlList.SetItemData(index, (LPARAM)pItemInfo);



    This is working fine, but the debugger detects memory leaks when quitting the app. I think the pointers should be deleted, but I don't know how. When they are in scope, I can't delete them because the CALLBACK needs them. Is it possible to delete them when exiting? Or is there something else I should do?

    Any help is appreciated,

    Stijn



  2. #2
    Join Date
    May 1999
    Location
    Antwerp, Belgium
    Posts
    136

    Re: Memory leaks

    Delete them when your parentwindow is closed.


  3. #3
    Join Date
    May 1999
    Posts
    48

    Re: Memory leaks

    Delete all zone allocated with new in LVN_DELETEALLITEMS
    Sincerely, Mihai



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured