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. P/Invoke memory leakage

P/Invoke memory leakage

Scheduled Pinned Locked Moved C#
questioncsharpc++performancehelp
2 Posts 2 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.
  • T Offline
    T Offline
    ting668
    wrote on last edited by
    #1

    Hi all, I p/Invoke a VC++ dll in C#, but there is serious memory leak, how can I fix the memory leakage by the VC++ dll caused by P/Invoke ? (the leakage seem not come from the internal C++ code inside the dll, so I suspect it come from the loading and unloading of the dll in C#) Thanks

    M 1 Reply Last reply
    0
    • T ting668

      Hi all, I p/Invoke a VC++ dll in C#, but there is serious memory leak, how can I fix the memory leakage by the VC++ dll caused by P/Invoke ? (the leakage seem not come from the internal C++ code inside the dll, so I suspect it come from the loading and unloading of the dll in C#) Thanks

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! If it were like you say everybody would have serious problems using P/invoke. I think it's very unlikely for the P/invoke mechanism to create memory leaks the dll itself doesn't. The first time you call a p/invoke function, the containing DLL is loaded and as soon as the class you declared the function in goes out of scope (usually when unloading the AppDomain), the DLL is released. What exactly are the signatures of your functions and your DllImport declarations? mav

      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