Don’t ignore baseclass methods in OSObject

Having spent an hour so (and more than a few reboots) – here’s a reminder to myself (and other hapless souls). 

Just because OSObject is pretty abstract and can’t be constructed on it’s own that doesn’t mean you can ignore its methods. In my case I was stymied by an apparent ‘hanging’ reference even though I could see that my very simple OSObject subclass was allocated only once and free() was called as the reference count went to zero.

My mistake was not to call the baseclass OSObject::free() from my own method – so of course although I thought (knew) I was done with the object the rest of the IOKit/kernel wasn’t so convinced.

So… don’t forget that OSObject still does very important things – even if it does seem a bit of a placeholder !

Posted under Apple, Development

This post was written by awk on March 1, 2009

Tags: , , ,

Leave a Comment

Name (required)

Email (required)

Website

Comments

More Blog Post