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#
  4. Memory leak issue, memory management of unmanaged code

Memory leak issue, memory management of unmanaged code

Scheduled Pinned Locked Moved C#
csharphelpdotnetcomdesign
7 Posts 4 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.
  • L Offline
    L Offline
    logicaldna
    wrote on last edited by
    #1

    hi i'm having a issue with memory management in a COM which uses MSXML (cause of memory leak) if i use a c# wrapper around the COM which is then called from .net webservice will CLR take care of memory management for me( essentially Garbage collection) if not by design can i force GC to take care of memory leaks in COM this is very urgent, please help ! :(( sorry i'm posting it in different forums at a time but hope you will see a desparation :->

    Chase your dreams ! http://eminencetech.net[^]

    S J P 3 Replies Last reply
    0
    • L logicaldna

      hi i'm having a issue with memory management in a COM which uses MSXML (cause of memory leak) if i use a c# wrapper around the COM which is then called from .net webservice will CLR take care of memory management for me( essentially Garbage collection) if not by design can i force GC to take care of memory leaks in COM this is very urgent, please help ! :(( sorry i'm posting it in different forums at a time but hope you will see a desparation :->

      Chase your dreams ! http://eminencetech.net[^]

      S Offline
      S Offline
      Shy Agam
      wrote on last edited by
      #2

      The GC does not re-claim unmanaged memory. Regards, Shy.

      L 1 Reply Last reply
      0
      • S Shy Agam

        The GC does not re-claim unmanaged memory. Regards, Shy.

        L Offline
        L Offline
        logicaldna
        wrote on last edited by
        #3

        thanks for the reply, but can i force it in anyway, is it possible if i use COM as RCW

        Chase your dreams ! http://eminencetech.net[^]

        S 1 Reply Last reply
        0
        • L logicaldna

          thanks for the reply, but can i force it in anyway, is it possible if i use COM as RCW

          Chase your dreams ! http://eminencetech.net[^]

          S Offline
          S Offline
          Shy Agam
          wrote on last edited by
          #4

          You cannot force the GC to collect objects from unmanaged memory. The GC works only on objects created by the CLR. Hence the expression "UNMANAGED memory". :) If your COM object contains cleanup methods, use them.

          logicaldna wrote:

          is it possible if i use COM as RCW

          Sorry, but I don't think I know what RCW means... Maybe someone else here can help you with that.

          L 1 Reply Last reply
          0
          • S Shy Agam

            You cannot force the GC to collect objects from unmanaged memory. The GC works only on objects created by the CLR. Hence the expression "UNMANAGED memory". :) If your COM object contains cleanup methods, use them.

            logicaldna wrote:

            is it possible if i use COM as RCW

            Sorry, but I don't think I know what RCW means... Maybe someone else here can help you with that.

            L Offline
            L Offline
            logicaldna
            wrote on last edited by
            #5

            shyagam wrote:

            If your COM object contains cleanup methods, use them

            i have tried all and even COuninitialize is not cleaning the memory dam this MSXML:confused: thanks anyways sagar

            Chase your dreams ! http://eminencetech.net[^]

            1 Reply Last reply
            0
            • L logicaldna

              hi i'm having a issue with memory management in a COM which uses MSXML (cause of memory leak) if i use a c# wrapper around the COM which is then called from .net webservice will CLR take care of memory management for me( essentially Garbage collection) if not by design can i force GC to take care of memory leaks in COM this is very urgent, please help ! :(( sorry i'm posting it in different forums at a time but hope you will see a desparation :->

              Chase your dreams ! http://eminencetech.net[^]

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

              When using COM objects in C# setting an object to null isn't all that's required to signal it ready for Garbage Collection. First a call must be made to Marshal.ReleaseComObject(aComObjectVariable) to decrement it's reference counter in the RCW. MSDN[^]

              1 Reply Last reply
              0
              • L logicaldna

                hi i'm having a issue with memory management in a COM which uses MSXML (cause of memory leak) if i use a c# wrapper around the COM which is then called from .net webservice will CLR take care of memory management for me( essentially Garbage collection) if not by design can i force GC to take care of memory leaks in COM this is very urgent, please help ! :(( sorry i'm posting it in different forums at a time but hope you will see a desparation :->

                Chase your dreams ! http://eminencetech.net[^]

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #7

                logicaldna wrote:

                i'm posting it in different forums at a time

                That's not polite and it gets people ticked off and less likely to respond.


                "You will see a delete button on each of your posts. Press it." - Colin Angus Mackay

                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