Main Content

Fix Insufficient Memory Errors During Polyspace Report Generation

Issue

When generating reports from Polyspace® results containing a very large number of defects or coding rule violations, you might encounter insufficient memory errors.

The error message can look like this message:

....
Exporting views... 
Initializing... 
Polyspace Report Generator 
Generating Report 
 ..... 
    Converting report 
Opening log file:  C:\Users\auser\AppData\Local\Temp\java.log.7512 
Document conversion failed 
.....
Java exception occurred: 
java.lang.OutOfMemoryError: Java heap space 

Possible Solutions

To resolve the issue, you can try increasing the available heap memory or reporting the results over multiple reports instead of in a single report.

Increase Java Heap Size

If the error occurs during report generation, try increasing the Java® heap size. The default heap size in a 64-bit architecture is 1024 MB.

To increase the size:

  1. Navigate to polyspaceroot\polyspace\bin\architecture. Where:

    • polyspaceroot is the installation folder.

    • architecture is your computer architecture, for instance, win32, win64, etc.

  2. Change the default heap size that is specified in the file, java.opts. For example, to increase the heap size to 2 GB, replace 1024m with 2048m.

  3. If you do not have write permission for the file, copy the file to another location. After you have made your changes, copy the file back to polyspaceroot\polyspace\bin\architecture\.

Report Polyspace Results in Multiple Reports

Instead of reporting all results from a result set (.pscp or .psbf file) in a single report, you can generate multiple reports, each containing a smaller subset of results.

The simplest strategy can be to report results of a certain type in a single report. For instance, from a results set containing MISRA C™:2012 rule violations, you can generate two reports, one for the mandatory and required rules, and another for the remaining rules.

Apply Review Scopes and Generate Filtered Report.  You can create named sets of filters called review scopes in the user interface of the Polyspace desktop products. When generating a report, you can apply a review scope that filters the results before storing them in the report.

To create a review scope:

  1. In the Polyspace user interface, select Tools > Preferences.

  2. On the Review Scope tab, select New. Enter a review scope name and a location to save.

    When saving a review scope, enter a name in the Scope Name field.

    The review scope name can be used later when filtering the results.

  3. Select the checkers that you want to be included in the review scope.

You can generate a filtered report from a Polyspace results set by applying a review scope before report generation. The report contains results of only those checkers that are included in the review scope. Note that even though you create the review scope in the user interface, you can apply the scope for report generation in the user interface or at the command line.

To generate a filtered report in the Polyspace user interface:

  1. In the dropdown at the top of the Results List pane, instead of All results, select your new review scope. The list of results is narrowed down to results of only those checkers that are included in the review scope.

  2. Generate a report or export results using the Reporting menu.

    • To generate reports, select Run Report. In the Run Report dialog, select Only include currently displayed results before starting report generation.

    • To export results select Export > Export Currently Displayed Results.

To generate a filtered report at the command line, use the option -wysiwyg scopeName with the command polyspace-report-generator. Here, scopeName is the review scope name that you used when saving the scope from the Polyspace user interface. For instance:

polyspace-report-generator -template templateName -results-dir resultsFolder -format HTML -wysiwyg scopeName
Here:

  • templateName is the path to a report template, such as polyspaceroot\toolbox\polyspace\psrptgen\templates\Developer.rpt, where polyspaceroot is the Polyspace installation folder such as C:\Program Files\Polyspace\R2024b.

  • resultsFolder is the folder containing Polyspace results.

Note that the scope names are stored with your user preferences. Therefore, you cannot use the scopes names for report generation with another Polyspace installation, for instance, from a different release. For more information on user preferences, see Storage of Polyspace User Interface Customizations.

Apply Column-Based Results List Filters and Generate Filtered Report.  You can also filter results in the Polyspace user interface using column-based filters and create a filtered report from the currently displayed results:

  1. Click the icon on column headers of the Results List pane to see the available filters. Apply the filters that you want.

  2. Generate a report or export results using the Reporting menu.

    • To generate reports, select Run Report. In the Run Report dialog, select Only include currently displayed results before starting report generation.

    • To export results select Export > Export Currently Displayed Results.

The generated report states which columns were used to filter results. For instance, if you use the Status column to suppress all results with status Justified, the generated report contains this line:

Columns with active filters:
   Status
All results with status Justified do not appear in the report.

Your choice of column-based filters are stored in the file ui_settings.prf in the .settings subfolder of the results folder. Therefore, if you generate a report from these results at the command line and use the option -wysiwyg "All results" (or with a scope name as shown in previous section), your choice of column-based filters apply to the generated report. You can even move the file ui_settings.prf to .settings subfolders of other results folders to generate filtered reports from those other results.

See Also

Related Topics