According to Mahabharata 3.191, the duration of the stay in Swargaloka depends on the quantum of good deeds the person has done on earth. When people on earth no longer remember the good deeds the person has done, he is sent out of Swargaloka.