Detailed theoretical analysis of longitudinal spatial hole burning in quantum-dot (QD) lasers is given. Unlike conventional semiconductor lasers, escape of thermally excited carriers from QDs, rather than diffusion, is shown to control the smoothing-out of the spatially nonuniform population inversion and multimode generation in QD lasers. The multimode generation threshold is calculated as a function of structure parameters (surface density of QDs, QD size dispersion, and cavity length) and temperature. A decrease in the QD size dispersion is shown to increase considerably the relative multimode generation threshold. The maximum tolerable QD size dispersion and the minimum tolerable cavity length, at which lasing is possible to attain, are shown to exist. Concurrent with the increase of threshold current, an increase of the multimode generation threshold is shown to occur with a rise in temperature. Ways to optimize the QD laser, aimed at maximizing the multimode generation threshold, are outlined.