• Luckily, I'm getting a bunch of zero counts with this script.

    Might be nicer to filter out queries that don't have any pages allocated/deallocated?

    SELECT

    er.session_id,

    er.request_id,

    er.sql_handle,

    er.statement_start_offset,

    er.statement_end_offset,

    er.plan_handle,

    counts.task_alloc,

    counts.task_dealloc

    FROM sys.dm_exec_requests AS er

    INNER JOIN

    (SELECT

    session_id,

    request_id,

    SUM(internal_objects_alloc_page_count) AS task_alloc,

    SUM(internal_objects_dealloc_page_count) AS task_dealloc

    FROM sys.dm_db_task_space_usage

    WHERE internal_objects_alloc_page_count<>0

    OR internal_objects_dealloc_page_count<>0

    GROUP BY session_id, request_id

    ) AS counts

    ON counts.session_id = er.session_id AND counts.request_id = er.request_id

    ORDER BY counts.task_alloc DESC