Wikipedia
In Roman Catholic theology, purgatory is an intermediate state after physical death in which some of those ultimately destined for heaven must first “undergo purification, so as to achieve the holiness necessary to enter the joy of heaven,” holding that “certain offenses can be forgiven in this age, but certain others in the age to come.” And that entrance into Heaven requires the “remission before God of the temporal punishment due to sins whose guilt has already been forgiven,” for which indulgences may be given which remove “either part or all of the temporal punishment due to sin,” such as an “unhealthy attachment” to sin. https://en.wikipedia.org/wiki/Purgatory