Contenido principal

Maximum error occurrences (-sanitizer-max-error-occurrences)

R2026b

Specify the maximum number of sanitizer error occurrences to report

Since R2026b

Description

Specify the maximum number of error occurrences that the sanitizer reports at runtime. When the sanitizer reaches this number, it stops reporting additional errors. Set the value to 0 to report an unlimited number of errors.

Set Option

Set the option using one of these methods:

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Testing and Profiling tab, select the Sanitizer node and then enter a value for this option.

  • Command line: Use the option -sanitizer-max-error-occurrences. See Command-Line Information.

  • Python® API: Set the MaxErrorOccurrences property in the testing and profiling configuration. See polyspace.project.TestConfiguration.

  • TOML configuration file (.toml.pscfg) — Use the key MaxErrorOccurrences in the [SanitizerOptions] table. For example:

    [SanitizerOptions]
    MaxErrorOccurrences = 5

Why Use This Option

Use this option to limit the number of errors reported by the sanitizer. If your code has many runtime errors, limiting the number of reported occurrences can help you focus on the most critical issues first. Setting the value to 0 allows unlimited error reporting.

Settings

Default: 0 (unlimited)

Enter a non-negative integer value. A value of 0 means the sanitizer reports all error occurrences without limit.

Command-Line Information

The command-line workflow for setting this option depends on your workflow.

  • If you build your source and tests using a Polyspace Platform Project — Once you set this option in the project using the Polyspace Platform user interface, you cannot override or modify this option using the polyspace-test command.

  • If you build your sources and xUnit tests using your own toolchain — Specify this option to the polyspace-code-profiler command.

Parameter: -sanitizer-max-error-occurrences
Value: Non-negative integer (0 = unlimited)
Default: 0
Example: polyspace-code-profiler -instrument -instrum-dir instrumFolder -sanitizer -sanitizer-max-error-occurrences 100 -- compileCommand

Version History

Introduced in R2026b