• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Debugging dreams?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging dreams?


  • Subject: Re: Debugging dreams?
  • From: Cem Karan <email@hidden>
  • Date: Thu, 8 Jun 2006 07:59:03 -0400

On a different note, I've come to realize how useful automatic garbage collection could be for debugging; if you hook the debugger and collector together, and force collection every time you step, then if you attempt to follow a dead pointer, the garbage collector will know if its pointing to anything that is live on the heap. If its pointing to something on the stack, you already have enough info to figure that one out... you could even query the collector for what pointers are currently alive, even the ones that are disconnected from anything.

Kinda off-topic, but assuming you're talking about "normal" garbage collection, you can't get a dead pointer; if an object is still referenced, it won't be collected.

Yes, which is why the debugger and the garbage collection library would need to know about and work with one another. The garbage collector would not run on its own, it would be called by the debugger at each step (yes I know its slow, but this is a bad pointer detection method, not production code!) Once the step is done, if you try to follow a pointer, the debugger can once again use the garbage collector to see if the pointer is going to be pointing at anything (the garbage collector has to have all this info somewhere or it won't work right). Note that this would only be useful in those cases where your pointer is pointing to some random, unassigned location in memory; if your pointer is off by one, but still within, say, your array, the garbage collector would only be able to say that yes, your pointer is pointing to a live object in that array (think about an array or linked list you create, and then walk with another pointer). You also wouldn't be protected by accidents where you move your list pointer forward in a singly linked list; once you've moved the head forward, and there's no going back, then its garbage collected.


Thanks,
Cem Karan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Debugging dreams? (From: Cem Karan <email@hidden>)
 >Re: Debugging dreams? (From: Jonathon Mah <email@hidden>)

  • Prev by Date: template error and Jam failed with exit code 1
  • Next by Date: Re: Compile error
  • Previous by thread: Re: Debugging dreams?
  • Next by thread: Re: Debugging dreams?
  • Index(es):
    • Date
    • Thread