The excess free volume in grain boundaries of pure nanocrystalline aluminum leads to the grain coarsening, which degrades their desirable mechanical properties. The preferential segregation of dopants to the grain boundaries has been proposed to enhance the stability of the nanostructure. To shed light on the stabilization mechanisms, we present results from virtual mechanical tests on nanocrystalline aluminum samples with similar grain sizes but different magnesium dopant contents. The segregation of magnesium decreases the excess free volume within the grain boundaries and prohibits the nucleation and growth of intergranular cracks.