  Given a negative plurisubharmonic function $\phi$ in a bounded pseudoconvex
domain of ${\mathbb C}^n$, we introduce and study its residual function
$g_\phi$ determined by the asymptotic behavior of $\phi$ near its singularity
points, both inside the domain and on its boundary. For certain choices of
$\phi$, the function $g_\phi$ coincides with different versions of pluricomplex
Green functions. The considerations are motivated by a problem on when two
given plurisubharmonic functions can be connected by a plurisubharmonic
geodesic.
