Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Memory Leak

Memory Leak

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresperformance
5 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fareed Rizkalla
    wrote on last edited by
    #1

    I ran code analysis on my project. It told me I had a memory leak. I have a Linked List class with an Add function. The Add function receives parameters, then it creates a node and fills it with those parameters. I can't understand why their is a leak!

    M A 2 Replies Last reply
    0
    • F Fareed Rizkalla

      I ran code analysis on my project. It told me I had a memory leak. I have a Linked List class with an Add function. The Add function receives parameters, then it creates a node and fills it with those parameters. I can't understand why their is a leak!

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      ok, but how do you remove items from the list ? is it done automatically by the list class destructor ?

      Watched code never compiles.

      F 1 Reply Last reply
      0
      • M Maximilien

        ok, but how do you remove items from the list ? is it done automatically by the list class destructor ?

        Watched code never compiles.

        F Offline
        F Offline
        Fareed Rizkalla
        wrote on last edited by
        #3

        list class destructor!

        1 Reply Last reply
        0
        • F Fareed Rizkalla

          I ran code analysis on my project. It told me I had a memory leak. I have a Linked List class with an Add function. The Add function receives parameters, then it creates a node and fills it with those parameters. I can't understand why their is a leak!

          A Offline
          A Offline
          Aescleal
          wrote on last edited by
          #4

          This may sound like a daft couple of questions... - Are you sure the memory leak is in your class? Try swapping it for one that you know doesn't leak like std::list and run your analysis again. - Why on earth are you writing your own linked list? std::list will probably do as good a job in most cases. Ash

          D 1 Reply Last reply
          0
          • A Aescleal

            This may sound like a daft couple of questions... - Are you sure the memory leak is in your class? Try swapping it for one that you know doesn't leak like std::list and run your analysis again. - Why on earth are you writing your own linked list? std::list will probably do as good a job in most cases. Ash

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Aescleal wrote:

            - Why on earth are you writing your own linked list?

            Academia.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Man who follows car will be exhausted." - Confucius

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups