Could you please document memory management somewhere? At least comments in .cpp/.hpp/.xsp. 
It's hard to understand it from code alone...