It is well-known that a Leray-Hopf weak solution in $L^4 (0,T; L^4(\Omega))$ for the incompressible Navier-Stokes system is persistence of energy due to Lions . In this paper, it is shown that Lions's condition for energy balance is also valid for the weak solutions of the isentropic compressible Navier-Stokes equations allowing vacuum under suitable integrability conditions on the density and its derivative. This allows us to establish various sufficient conditions implying energy equality for the compressible flow as well as the non-homogenous incompressible Navier-Stokes equations. This is an improvement of corresponding results obtained by Yu in [32, Arch. Ration. Mech. Anal., 225 (2017)], and our criterion via the gradient of the velocity partially answers a question posed by Liang in [18, Proc. Roy. Soc. Edinburgh Sect. A (2020)].