fixed: memory leaks in pre-training.