solve memory management