Change memory management for OCL framework - this could probably be simpler, but at least I can figure out exactly what data is stored where and what the lifecycle of all the relevant objects should be.