Depends on the cursor type, as documented in
A forward-only cursor does not support scrolling; it
supports only fetching the rows serially from the start to the end of
the cursor. The rows are not retrieved from the database until they
are fetched ... Although the database API cursor models consider a
forward-only cursor to be a distinct type of cursor, SQL Server does
not. SQL Server considers both forward-only and scroll as options that
can be applied to static, keyset-driven, and dynamic cursors.
The complete result set of a static cursor is built in tempdb when the
cursor is opened. ...
The membership and order of rows in a
keyset-driven cursor are fixed when the cursor is opened.
Keyset-driven cursors are controlled by a set of unique identifiers,
keys, known as the keyset. The keys are built from a set of columns
that uniquely identify the rows in the result set. The keyset is the
set of the key values from all the rows that qualified for the SELECT
statement at the time the cursor was opened. The keyset for a
keyset-driven cursor is built in tempdb when the cursor is opened.
Dynamic cursors are the opposite of static cursors. Dynamic
cursors reflect all changes made to the rows in their result set when
scrolling through the cursor. The data values, order, and membership
of the rows in the result set can change on each fetch. ...
As for memory use, all data access goes through the buffer pool, see Memory Manager Architecture. There is no 'close' nor 'deallocation' occurring. Data is brought in memory as needed, it may be referenced by multiple queries, and evicted only when more free memory is required.