• Skip to main content
  • assistive.skiplink.to.breadcrumbs
  • assistive.skiplink.to.header.menu
  • assistive.skiplink.to.action.menu
  • assistive.skiplink.to.quick.search
Log in
Confluence
  • Spaces
  • Hit enter to search
  • Help
    • Online Help
    • Keyboard Shortcuts
    • Feed Builder
    • What’s new
    • Available Gadgets
    • About Confluence
  • Log in

SEI CERT C++ Coding Standard
SEI CERT C++ Coding Standard
  • Pages
  • Boards

Space shortcuts

  • Dashboard
  • Secure Coding Home
  • Android
  • C
  • C++
  • Java
  • Perl

Page tree

Browse pages
    • Attachments (0)
    • Page History
    • Page Information
    • Resolved comments
    • View in Hierarchy
    • View Source
    • Export to PDF
    • Export to Word
  1. Pages
  2. SEI CERT C++ Coding Standard
  3. 2 Rules
  • Jira links

Rule 06. Memory Management (MEM)

  • Created by Aaron Ballman, last modified by David Svoboda on Jun 25, 2025

  • Page:
    MEM50-CPP. Do not access freed memory
  • Page:
    MEM51-CPP. Properly deallocate dynamically allocated resources
  • Page:
    MEM52-CPP. Detect and handle memory allocation errors
  • Page:
    MEM53-CPP. Explicitly construct and destruct objects when manually managing object lifetime
  • Page:
    MEM54-CPP. Provide placement new with properly aligned pointers to sufficient storage capacity
  • Page:
    MEM55-CPP. Honor replacement dynamic storage management requirements
  • Page:
    MEM56-CPP. Do not store an already-owned pointer value in an unrelated smart pointer
  • Page:
    MEM57-CPP. Avoid using default operator new for over-aligned types


The following rules from the SEI CERT C Coding Standard also apply in C++:

  • Page:
    MEM30-C. Do not access freed memory
  • Page:
    MEM31-C. Free dynamically allocated memory when no longer needed
  • Page:
    MEM34-C. Only free memory allocated dynamically
  • Page:
    MEM35-C. Allocate sufficient memory for an object
  • Page:
    MEM36-C. Do not modify the alignment of objects by calling realloc()

Information for Editors
To have a new guideline automatically listed above be sure to label it mem and rule.

Risk Assessment Summary

Rule

Severity

Likelihood

Detectable

Repairable

Priority

Level

MEM50-CPPHighLikelyNoNo

P9

L2

MEM51-CPPHighLikelyNoNo

P9

L2

MEM52-CPPHighLikelyYesYes

P27

L1

MEM53-CPPHighLikelyNoNo

P9

L2

MEM54-CPPHighLikelyNoNo

P9

L2

MEM55-CPPHighLikelyNoNo

P9

L2

MEM56-CPPHighLikelyNoNo

P9

L2

MEM57-CPPMediumUnlikelyNoNo

P2

L3




  • rule-list
  • rule
  • mem
  • section
Overview
Content Tools
  • Powered by Atlassian Confluence 8.5.23
  • Printed by Atlassian Confluence 8.5.23
  • Report a bug
  • Atlassian News
Atlassian

Carnegie Mellon University
Software Engineering Institute
4500 Fifth Avenue
Pittsburgh, PA 15213-2612
412-268-5800

Contact Us
  • Office Locations|
  • Additional Sites Directory|
  • Legal|
  • Privacy Notice|
  • CMU Ethics Hotline|
  • www.sei.cmu.edu

©2025 Carnegie Mellon University

{"serverDuration": 96, "requestCorrelationId": "a76ce1d99b5bf16f"}