I am wondering whether I simply have relative pitch, or some sort of pitch memory that is well developed. I can sing any note without a reference pitch that is sounded aloud, but does it count if I sometimes have a reference pitch in my head (I do not hesitate on singing notes aloud, I can do it immediately)? I am also wondering because sometimes I use a reference pitch in my head to identify the key of pieces. Does it count of perfect pitch if there is a reference note internally?
Even though you have a "memorized" reference pitch in your "mind's ear", the fact that you use it to identify other pitches suggests you have relative pitch plus a particularly strong memory for your reference pitch.
Absolute (perfect) pitch generally means that you simply "know" a pitch without reference to any other pitch, memorized or otherwise.
You might find this post of the Levitin Effect helpful. The concept is related, though may or may not apply directly to your experience.
If you can sing or identify notes without other reference notes, you have perfect pitch.
In particular, if you can always sing or identify a note precisely from a cold start -- i.e. let's say first thing in the morning -- that qualifies as perfect pitch.
Having some reference pitch present in your mind, after you have been singing or playing or listening, that's natural and inevitable. In that case, the two types of perception overlap: on one hand, your perfect pitch tells you what note this is, and on the other hand, your relative pitch tells you that this note has a certain interval from that other note (regardless of whether this or that note are heard externally or internally).
A mature musical ear is a synthesis of all these different skills.