Category swapping in memory management