Intel® Advisor User Guide

ID 766448
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents
Give Feedback

Memory Reuse, Child Task

Occurs when two tasks write to a shared memory location, where a parent task overwrites a variable with a new value that was read by a previously executed child task. A child task is a task nested inside another task.

Problem type: Memory reuse

ID

Code Location

Description

1

Allocation site

If present, and if the memory involved is heap memory, represents the location and associated call stack when the memory was allocated.

2

Parallel site

If present, represents the location and associated call stack of the parallel site containing the Memory Reuse, Child Task problem.

3

Read

Represents the instruction and associated call stack of the first access if it is a memory read.

4

Write

Represents the instruction and associated call stack of the second access if it is a memory write.

Example

int global;
void main()
{
    ANNOTATE_SITE_BEGIN(reuse_site);   // Begin parallel site
        ANNOTATE_TASK_BEGIN(task111);
            assert(global == 111);     // Read 
        ANNOTATE_TASK_END();
        global = 222;                  // Write
    ANNOTATE_SITE_END();
}

In this example, a parent task is writing to a shared variable after a task that reads that same variable.

Some Possible Correction Strategies

Create a private copy of the variable before executing the child task. Use the private copy in the child task.