I need file system notifications in Mac OS X and i'm reading from /dev/fsevents. A Sample code of capturing fsevents in Mac OS X : http://www.codecollector.net/view/1066/raw_fsevents. In this code, you can see the buffer read from /dev/fsevents is processed as soon as it is read. But when i do that, events are missing due to the delay created in processing. So i have created a new char pointer and memcpy'd the buffer read from /dev/fsevents and added the new char* to a queue and processed the queue in a new thread. But when i process the char* like in 'print_event' & 'dump_entry', the char* pointer gets realligned and when i check for strlen() after processing, it says 0 or 1 bytes length only. So during processing, the memory is leaking.
Any idea how to delete the allocated char*, this is leaking more memory for more events. Please share your thoughts on this. Thanks in advance.