  We establish the optimal order of Malliavin-type remainders in the asymptotic
density approximation formula for Beurling generalized integers. Given
$\alpha\in (0,1]$ and $c>0$ (with $c\leq 1$ if $\alpha=1$), a generalized
number system is constructed with Riemann prime counting function $ \Pi(x)=
\operatorname*{Li}(x)+ O(x\exp (-c \log^{\alpha} x ) +\log_{2}x), $ and whose
integer counting function satisfies the extremal oscillation estimate
$N(x)=\rho x + \Omega_{\pm}(x\exp(- c'(\log x\log_{2}
x)^{\frac{\alpha}{\alpha+1}})$ for any $c'>(c(\alpha+1))^{\frac{1}{\alpha+1}}$,
where $\rho>0$ is its asymptotic density. In particular, this improves and
extends upon the earlier work [Adv. Math. 370 (2020), Article 107240].
