Go to main content
Oracle® Developer Studio 12.6: IDE Quick Start Tutorial

Exit Print View

Updated: June 2017
 
 

Running Memory Access Checking on Your Project

You can use the Memory Analysis Tool to find memory access errors in your project. The tool allows you to find these errors easily by pointing out exactly where each error occurs in your source code.

The Memory Analysis tool catches and reports memory access errors dynamically during program execution, so if a portion of your code is not executed at run time, errors in that portion are not reported.

  1. If you have not already done so, download the sample applications zip file from the Oracle Developer Studio 12.6 Sample Applications web page at http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/solaris-studio-12-4-samples-2333090.html, and unzip the file in a location of your choice. The memorychecks application is located in the CodeAnalyzer subdirectory of the OracleDeveloperStudio12.5-Samples directory.

  2. Create a project from existing sources using the memorychecks application.

  3. Right-click the project and choose Properties. In the Project Properties dialog box, select the Run node, and type Customer.db after the output path in the Run Command. Click OK.

  4. Run the project.

  5. Build the project with instrumentation for memory analysis.

    1. Click the down arrow next to the Profile Project button image:Profile Project button and select Profile Project to find Memory Access Errors from the drop-down list.

    2. In the Select Analysis Type dialog box, select All Memory Access Errors from the drop-down list.

      image:Select Analysis Type dialog box

      The Overhead field displays High or Moderate to indicate the load that will be placed on the system. The performance of other programs running on your system might be affected when the overhead is high, which is the case when you are detecting both data races and deadlocks.

    3. Click Start.

  6. The Run Memory Profile dialog box opens to let you know that your binary will be instrumented. Click OK.

  7. The project is built and instrumented. The application starts running and the Memory Analysis window opens. When your project run is complete, the Memory Analysis window lists the memory access error types found in your project. The number of errors of each type is shown in parentheses after the error type.

    image:Memory Analysis window
  8. When you click on an error type, the errors of that type are displayed in the Memory Analysis Tool window.

    image:Memory analysis tool window

    By default, the errors are grouped by the source file in which they were found. When you click on an error, the call stack for that error is displayed. Double-click a function call in the stack to display the associated lines in the source file.