Consciousness is often said to disappear in deep, dreamless sleep. We argue that this assumption is oversimplified. Unless dreamless sleep is defined as unconscious from the outset there are good empirical and theoretical reasons for saying that a range of different types of sleep experience, some of which are distinct from dreaming, can occur in all stages of sleep.
Presumably in your scenario the victim remembers the torture though.
In the case of general anaesthetic the memory is effectively considered to be deleted in real time. On its way through the brain it ceases to exist so it never reaches the conscious mind.