"* The CGEventRef passed into the callback is retained by the calling
* code, and is released after the callback returns and the data is
* passed back to the event system. If a different event is returned
* by the callback function, then that event will be released by the
* calling code along with the original event, after the event data
* has been passed back to the event system."
So in my application, I don't release the incoming event. (I tried releasing it at the end of my function implementation, just to see what would happen, and my application promptly crashed the next time I pressed a key).
However, the Leaks tool and Instruments both say my application is leaking a CGEvent every time my callback function is called. Yet my application's memory footprint does not increase over time (according to Activity Monitor). Is this a case of Leaks and Instruments simply reporting incorrect results because they don't know the system is releasing the event after the callback returns it? Or am I supposed to do something myself -- and, if so, what should I do and where? (Or maybe, of course, I'm leaking it somewhere else, but I can't find any problem in my code.)