Fix memory management
Calculate new pred length in cgp thread, apply in pred thread