Author : Olivier Langlois I found 3 memory leaks in the csEventQueue class. When csEventQueue::Clear() is called, the head and tail indexes are reseted without deleting the events contained in the queue. The same thing occur in the csEventQueue destructor. The array of events pointers is deleted without deleting the event objects contained this array. Also, in the csEventQueue::Put() function, when the queue is full, the new event is quietly discarded. This is also a memory leak. I have considered 2 solutions to this problem. The first one is to return an error code to the caller so that he can delete the event object that he was trying to insert in the queue. This isn't a good solution because it would break a lot of code already using this class. The other solution, the one I have used, is to dynamically enlarge the queue when the queue is full so that it can never be full. A possible enhancement to this scheme would be to verify that a maximum size is never reached. If this ever happen then the class could notify the user he may have forget to handle events and then the program would exit. Another potential problem in this class, is that in order to work properly, the queue lenght must be a 2^n multiple. Otherwise, the head index will be incremented in a strange way. This is caused by how the class detect when the head index reach the end of the array (a bit to bit AND). I have decided to verify this condition with the following statement if( evqHead == length ) evqHead = 0; This could also have been fixed by checking in the constructor that the length is effectively a 2^n multiple but I wanted to eliminate the 2^n multiple limitation. As long as the queue size is small it is not so terrible to double the length when you want to enlarge the queue size but it can start to be annoying when the queue begins to be very large (imagine having to double a 2^15 elements queue).