Memory errors (-sanitizer-selection memory)
R2026bEnable detection of memory errors at runtime
Since R2026b
Description
Specify whether the sanitizer detects memory safety violations at runtime. Memory errors include null pointer dereference, out-of-bounds pointer access, use-after-free, double deallocation, invalid free or delete operations, memory allocation errors, and standard library memory 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, select Select by category, and then select or clear this option.
Command line: Use the option
-sanitizer-selectionand includememoryin the comma-separated list. See Command-Line Information.Python® API: Set the
Memoryproperty in the testing and profiling configuration. Seepolyspace.project.TestConfiguration.TOML configuration file (
.toml.pscfg) — Use the keyMemoryin the[SanitizerOptions]table. For example:[SanitizerOptions] Memory = true
Why Use This Option
Use this option to detect memory safety violations in your code at runtime. The sanitizer instruments your source code to check for errors such as:
Null pointer dereference
Out-of-bounds pointer access
Use-after-free
Double deallocation
Invalid free or delete operations
Unprotected memory allocation
Standard library memory errors
Settings
On (default)The sanitizer detects memory errors at runtime.
OffThe sanitizer does not detect memory errors.
Dependencies
This option is available only when you select Select by category as the sanitizer selection mode.
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-testcommand.If you build your sources and xUnit tests using your own toolchain — Specify this option to the
polyspace-code-profilercommand.
Parameter: -sanitizer-selection |
Value: Include memory in comma-separated list of error categories |
| Default: on |
Example:
polyspace-code-profiler -instrument -instrum-dir |
Version History
Introduced in R2026b