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. Managed C++/CLI
  4. delete question

delete question

Scheduled Pinned Locked Moved Managed C++/CLI
questionc++hosting
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.
  • Y Offline
    Y Offline
    Yaakov Davis
    wrote on last edited by
    #1

    Hi all. 1. I have a native struct with a pointer member. typedef struct someStruct SomeStruct; struct someStruct{ ... SomeStruct *tp_nextp; }; I'm hosting that struct in a managed class as a field. Do I need to use the delete keyword on the pointer when the managed object is disposed? 2. If I put a pointer to a member of that struct, does it need to be deleted? Thanks, Yaakov

    S 1 Reply Last reply
    0
    • Y Yaakov Davis

      Hi all. 1. I have a native struct with a pointer member. typedef struct someStruct SomeStruct; struct someStruct{ ... SomeStruct *tp_nextp; }; I'm hosting that struct in a managed class as a field. Do I need to use the delete keyword on the pointer when the managed object is disposed? 2. If I put a pointer to a member of that struct, does it need to be deleted? Thanks, Yaakov

      S Offline
      S Offline
      Steve Maier
      wrote on last edited by
      #2

      What I had seen when I was using MC++ was that if I had a COM object that was used inside of a managed object, the memory and the COM object would be cleaned up but only after the application exited, not when the managed object went away. We had to call a function to delete the COM object when we wanted to when the managed object was disposed. Not sure if it would be the same for you, but you could always turn that unmanaged struct into a class and put some code into the destructor to see when it gets called. Steve Maier, MCSD MCAD

      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