priv_data is allocated/freed internally