Dirichlet processes and Poisson-Dirichlet processes alleviate this problem by using an auxiliary variable trick (Robert and Casella, 2004).
we introduce an auxiliary variable over which we also sample but do not need to record.