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. There's no memory leak in my code(rather sure), then how to find out those codes who eat up my memory?

There's no memory leak in my code(rather sure), then how to find out those codes who eat up my memory?

Scheduled Pinned Locked Moved C / C++ / MFC
c++debuggingtoolsperformancehelp
9 Posts 7 Posters 0 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
    Falconapollo
    wrote on last edited by
    #1

    Now, I have a VC++ project which will occupy 1.5 G memory(the peak value), and then it will give back memory in 5 minutes. But, I want to optimize the memory usage, because 1.5 G is too huge. Besides, I'm rather sure there are no memory leaks in my codes, I have tested my codes with 3 tools(PurifyPlus, Debug Diagnostic and CMemoryState function). Anybody can help me? Or are there some tools to help me to do that? Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'. So, don't mention 'memory leaks' in the comments. PS: I'm using Visual C++ 2010. And my project is made up of about 1400k lines of code.

    L C J J S 6 Replies Last reply
    0
    • F Falconapollo

      Now, I have a VC++ project which will occupy 1.5 G memory(the peak value), and then it will give back memory in 5 minutes. But, I want to optimize the memory usage, because 1.5 G is too huge. Besides, I'm rather sure there are no memory leaks in my codes, I have tested my codes with 3 tools(PurifyPlus, Debug Diagnostic and CMemoryState function). Anybody can help me? Or are there some tools to help me to do that? Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'. So, don't mention 'memory leaks' in the comments. PS: I'm using Visual C++ 2010. And my project is made up of about 1400k lines of code.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Falconapollo wrote:

      Anybody can help me?

      With what? All we know is that your application uses a lot of memory.

      Use the best guess

      F 1 Reply Last reply
      0
      • L Lost User

        Falconapollo wrote:

        Anybody can help me?

        With what? All we know is that your application uses a lot of memory.

        Use the best guess

        F Offline
        F Offline
        Falconapollo
        wrote on last edited by
        #3

        Because there are lots of codes, so I want to find some tools to help me. It's alomost impossible to find out the problematical codes manually.

        L 1 Reply Last reply
        0
        • F Falconapollo

          Because there are lots of codes, so I want to find some tools to help me. It's alomost impossible to find out the problematical codes manually.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Then you need to go and look for the tools. As it stands your question is unanswerable.

          Use the best guess

          1 Reply Last reply
          0
          • F Falconapollo

            Now, I have a VC++ project which will occupy 1.5 G memory(the peak value), and then it will give back memory in 5 minutes. But, I want to optimize the memory usage, because 1.5 G is too huge. Besides, I'm rather sure there are no memory leaks in my codes, I have tested my codes with 3 tools(PurifyPlus, Debug Diagnostic and CMemoryState function). Anybody can help me? Or are there some tools to help me to do that? Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'. So, don't mention 'memory leaks' in the comments. PS: I'm using Visual C++ 2010. And my project is made up of about 1400k lines of code.

            C Offline
            C Offline
            CPallini
            wrote on last edited by
            #5

            If there are no leaks in your code, where are they (if you suspect there are)? Are you using third party code?

            Veni, vidi, vici.

            1 Reply Last reply
            0
            • F Falconapollo

              Now, I have a VC++ project which will occupy 1.5 G memory(the peak value), and then it will give back memory in 5 minutes. But, I want to optimize the memory usage, because 1.5 G is too huge. Besides, I'm rather sure there are no memory leaks in my codes, I have tested my codes with 3 tools(PurifyPlus, Debug Diagnostic and CMemoryState function). Anybody can help me? Or are there some tools to help me to do that? Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'. So, don't mention 'memory leaks' in the comments. PS: I'm using Visual C++ 2010. And my project is made up of about 1400k lines of code.

              J Offline
              J Offline
              jeron1
              wrote on last edited by
              #6

              Memory fragmentation possibly?

              1 Reply Last reply
              0
              • F Falconapollo

                Now, I have a VC++ project which will occupy 1.5 G memory(the peak value), and then it will give back memory in 5 minutes. But, I want to optimize the memory usage, because 1.5 G is too huge. Besides, I'm rather sure there are no memory leaks in my codes, I have tested my codes with 3 tools(PurifyPlus, Debug Diagnostic and CMemoryState function). Anybody can help me? Or are there some tools to help me to do that? Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'. So, don't mention 'memory leaks' in the comments. PS: I'm using Visual C++ 2010. And my project is made up of about 1400k lines of code.

                J Offline
                J Offline
                jschell
                wrote on last edited by
                #7

                Falconapollo wrote:

                Or are there some tools to help me to do that?

                Profilers will identify memory usage.

                Falconapollo wrote:

                Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'

                Which doesn't mean that memory is not being used incorrectly. For example some sort of map with duplicate data. Normally, at least for me, I have a fairly good idea of why an application uses code. There are of course only two real sources. First if you have something, one thing, that it is in fact big. And the second is if you have a whole lot of little things. Rather hard to code an application without actually knowing which of those cases is likely.

                1 Reply Last reply
                0
                • F Falconapollo

                  Now, I have a VC++ project which will occupy 1.5 G memory(the peak value), and then it will give back memory in 5 minutes. But, I want to optimize the memory usage, because 1.5 G is too huge. Besides, I'm rather sure there are no memory leaks in my codes, I have tested my codes with 3 tools(PurifyPlus, Debug Diagnostic and CMemoryState function). Anybody can help me? Or are there some tools to help me to do that? Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'. So, don't mention 'memory leaks' in the comments. PS: I'm using Visual C++ 2010. And my project is made up of about 1400k lines of code.

                  S Offline
                  S Offline
                  Stefan_Lang
                  wrote on last edited by
                  #8

                  As Richard said it's impossible to give accurate advice without seeing your code and the functions you call from third party libs (and of course posting 1400k lines of code is not an option). The questions you should try to answer for yourself are: 1. Can you pinpoint certain operations (at user interface level) of your applications that result in high memory use? 2. Which internal parts (functions) of your application do require large amounts of memory, even if only temporary? 3. Which calls to third party libraries result in allocation of memory that is not automatically released (e. g. functions that create large objects or data sets to hold results)? 4. What third party libraries do you use, and what do you know about their memory allocation scheme? The last question is targeted at libraries that use their own memory managers, which may or may not release unused memory blocks in a timely manner. Find the answers to these questions to better locate possible causes for your problem. Without that info, nobody can really help.

                  1 Reply Last reply
                  0
                  • F Falconapollo

                    Now, I have a VC++ project which will occupy 1.5 G memory(the peak value), and then it will give back memory in 5 minutes. But, I want to optimize the memory usage, because 1.5 G is too huge. Besides, I'm rather sure there are no memory leaks in my codes, I have tested my codes with 3 tools(PurifyPlus, Debug Diagnostic and CMemoryState function). Anybody can help me? Or are there some tools to help me to do that? Again, I must emphasize 'there are no memory leaks in my codes, I'm rather sure'. So, don't mention 'memory leaks' in the comments. PS: I'm using Visual C++ 2010. And my project is made up of about 1400k lines of code.

                    J Offline
                    J Offline
                    JackDingler
                    wrote on last edited by
                    #9

                    If the memory is returned, then it's not leaking. If you had a leak, then then the memory usage would keep growing until your application crashes. If you want your application to use less memory, then you'll have to look at how you use your data and the lifetime in which you keep it.

                    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