DEENESPTFRRUARHIKOZHNL

类 ara::core::MonotonicBufferResource

[SWS_CORE_06520] Upstream: RS_AP_00130

class MonotonicBufferResource :            public MemoryResource {...};

Implementation of std::pmr::monotonic_buffer_resource type from [mem.res.monotonic.buffer]

Header-Datei#include "ara/core/memory_resource.h"
Forwarding-Header#include "ara/core/core_fwd.h"
Scopenamespace ara::core
Basisklasse(n)MemoryResource

用户指南人工智能生成

在单调增长的缓冲区中管理内存块,具有无异常分配和集中释放特性。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 993d3b66f0fc 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

在单调增长的缓冲区中管理内存块,具有无异常分配和集中释放特性。

类 ara::core::MonotonicBufferResource 提供了一种专门的内存资源,用于从固定内存缓冲区或通过上游资源进行快速、单调的分配。请求的内存按步分配,且在单个释放操作中不会立即释放,而是统一通过 release()([SWS_CORE_06530])进行重置。所有操作均声明为完全无异常,其中内存不足通过返回 nullptr 而非异常来指示([SWS_CORE_06569])。这些实例不可拷贝,并且在从多个线程并发访问时需要外部同步。

上下文

类 ara::core::MonotonicBufferResource 是 AUTOSAR Adaptive Platform 模块 core 内的具体内存资源,并继承自基类 ara::core::MemoryResource。它针对安全相关和确定性车载应用调整了来自 [mem.res.monotonic.buffer] 的 C++ 标准已知概念 std::pmr::monotonic_buffer_resource。该类的主要作用是通过单调分配内存,以最小的管理开销满足来自连续内存区域的分配请求。

交互对象一方面是调用组件、多态分配器以及在运行时请求内存块的容器。另一方面,该类与可选的上层上游内存资源(MemoryResource)进行交互。该上游资源可以通过诸如 [SWS_CORE_06521] 等构造函数传入,并通过访问方法 upstream_resource()([SWS_CORE_06531])进行查询。

生命周期

ara::core::MonotonicBufferResource 的初始化可通过多个构造函数进行控制。除无参数默认构造函数([SWS_CORE_06524])外,还提供了接收显式上游资源的重载([SWS_CORE_06521])、定义初始缓冲区大小的重载([SWS_CORE_06525], [SWS_CORE_06522]),或将外部提供的原始内存区域(void* buffer, std::size_t buffer_size)用作初始缓冲区的重载([SWS_CORE_06526], [SWS_CORE_06523])。

在所有权关系方面,该类被定义为严格不可复制:复制构造函数([SWS_CORE_06527])和复制赋值运算符([SWS_CORE_06529])已被删除(=delete)。然而与 ISO-14882 标准不同,AUTOSAR 类通过移动构造函数([SWS_CORE_06576])和移动赋值运算符([SWS_CORE_06577])实现了显式移动语义,两者分别定义为 noexcept=default。

销毁通过析构函数 ~MonotonicBufferResource()([SWS_CORE_06528])进行。AUTOSAR 相对该标准的一个重要偏差在于析构函数未声明为虚函数。通过方法 release()([SWS_CORE_06530]),可在对象生命周期结束前重置全部已分配的内存。

在并发方面必须注意严格分离:无参构造函数([SWS_CORE_06524])、相等性检查 do_is_equal()([SWS_CORE_06571])以及查询 upstream_resource()([SWS_CORE_06531])被声明为线程安全。所有带参数的构造函数([SWS_CORE_06521]、[SWS_CORE_06522]、[SWS_CORE_06523]、[SWS_CORE_06525]、[SWS_CORE_06526])、分配操作([SWS_CORE_06569]、[SWS_CORE_06570])、release()([SWS_CORE_06530])以及析构函数([SWS_CORE_06528])均非线程安全,并行访问时需要外部同步。

使用路径

典型的应用流程包括提供、连续分配以及集中释放:

  1. 实例化:应用程序创建实例,例如指定缓冲区大小和上游资源([SWS_CORE_06522])或固定缓冲区([SWS_CORE_06526])。
  2. 分配:内存请求通过受保护的方法 do_allocate(bytes, alignment)([SWS_CORE_06569])处理。若现有缓冲区不足,该实例会从上游资源获取新的缓冲区。
  3. 释放:对 do_deallocate(p, bytes, alignment)([SWS_CORE_06570])的调用不会单独缩小缓冲区;内部配额指针单调向前移动。
  4. 缓冲区重置:使用 release()([SWS_CORE_06530])可一次性释放所有通过上游获取的内存块,缓冲区便可用于新的周期。
  5. 资源比较:通过 do_is_equal()([SWS_CORE_06571])可以检查两个内存资源是否相同。
单调分配与释放周期应用MonotonicBufferResourceUpstream-MemoryResourceErzeugungMonotonicBufferResource(initial_size, upstream)Speicher anforderndo_allocate(bytes, alignment)optInitialer Puffer unzureichendSpeicherblock anfordernallocate(bytes, alignment)Pufferspeicher bereitstellen指向内存区域的指针(或 nullptr)Speicher freigebendo_deallocate(p, bytes, alignment)Freigabe stillschweigend ignorieren重置缓冲区release()Allokierten Speicher freigeben

时序图:从分配、忽略释放到通过 release() 进行集体重置的典型内存周期。来源:[SWS_CORE_06522]、[SWS_CORE_06569]、[SWS_CORE_06570]、[SWS_CORE_06530]

错误场景

该类遵循针对无异常嵌入式系统的严格规定:所有成员函数、构造函数和运算符均声明为 noexcept,并提供完全的异常安全性。

在发生错误时,其行为特意偏离了标准库:

  • 分配失败:若 do_allocate()([SWS_CORE_06569])中的请求无法满足,不会抛出异常 std::bad_alloc,而是返回 nullptr。调用方必须强制检查返回值是否为 nullptr。
  • 释放错误:若在 do_deallocate()([SWS_CORE_06570])中释放时发生错误,根据规范将静默忽略该错误。
  • 通过基类指针销毁:由于析构函数([SWS_CORE_06528])不是虚函数,通过指向基类 MemoryResource 的指针进行销毁可能会导致未定义行为(Interpretation:销毁必须通过具体类型进行)。 问题 Q-add18020b48f3131 (未决)

本指南由 AI 系统基于 AUTOSAR Adaptive R25-11 规范生成。

成员图

类图

Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.

G nara__core__MonotonicBufferResource118 MonotonicBufferResource + MonotonicBufferResource() + operator=() + ~MonotonicBufferResource() + release() + upstream_resource() + do_allocate() + do_deallocate() + do_is_equal() nara__core__MemoryResource130 MemoryResource nara__core__MonotonicBufferResource118->nara__core__MemoryResource130

详细视图

请在大纲中选择一个条目。

构造函数和析构函数

except for the following deviations: 1. The function is noexcept ≙ [mem.res.monotonic.buffer]

重载 MonotonicBufferResource 8
explicit MonotonicBufferResource (MemoryResource *upstream) noexcept; SWS_CORE_06521
MonotonicBufferResource (std::size_t initial_size, MemoryResource *upstream) noexcept; SWS_CORE_06522
MonotonicBufferResource (void *buffer, std::size_t buffer_size, Memory Resource *upstream) noexcept; SWS_CORE_06523
MonotonicBufferResource () noexcept; SWS_CORE_06524
explicit MonotonicBufferResource (std::size_t initial_size) noexcept; SWS_CORE_06525
MonotonicBufferResource (void *buffer, std::size_t buffer_size) noexcept; SWS_CORE_06526
MonotonicBufferResource (const MonotonicBufferResource &)=delete; SWS_CORE_06527
MonotonicBufferResource (MonotonicBufferResource &&other) noexcept=default; SWS_CORE_06576

except for the following deviations: 1. The function is noexcept 2. The function is not virtual ≙ [mem.res.monotonic.buffer]

~MonotonicBufferResource () noexcept override;

方法

except for the following deviations: 1. The function is noexcept 2. The function returns nullptr instead of (potentially) throwing a std::bad_alloc exception ≙ std::bad_alloc

void * do_allocate (std::size_t bytes, std::size_t alignment) noexcept override;

except for the following deviations: 1. The function is noexcept 2. If unsuccessful: errors will be silently ignored ≙ [mem.res.monotonic.buffer]

void do_deallocate (void *p, std::size_t bytes, std::size_t alignment) noexcept override;

except for the following deviations: 1. The function is noexcept ≙ [mem.res.monotonic.buffer]

bool do_is_equal (const MemoryResource &other) const noexcept override;
release 函数

except for the following deviations: 1. The function is noexcept ≙ [mem.res.monotonic.buffer]

void release () noexcept;

except for the following deviations: 1. The function is noexcept ≙ [mem.res.monotonic.buffer]

MemoryResource * upstream_resource () const noexcept;

运算符

operator= 函数 2

≙ [mem.res.monotonic.buffer]

重载 = 2

方法文档

函数 MonotonicBufferResource [SWS_CORE_06521]

explicit MonotonicBufferResource (MemoryResource *upstream) noexcept;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06521
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06521@rel:R25-11#b85ab7cc
Content hash
b85ab7cc
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06521
Status: valid/unmigrated Version: rel:R25-11#cf52252c Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06521@rel:R25-11#cf52252c
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#b68d044b2026-09-30
  • R23-11rel:R23-11#76605f842026-10-14
  • R24-11rel:R24-11#5675ddf82026-10-14
  • R25-11rel:R25-11#cf52252c2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 MonotonicBufferResource [SWS_CORE_06522]

MonotonicBufferResource (std::size_t initial_size, MemoryResource *upstream) noexcept;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06522
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06522@rel:R25-11#9782c6b8
Content hash
9782c6b8
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06522
Status: valid/unmigrated Version: rel:R25-11#954d5cab Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06522@rel:R25-11#954d5cab
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#c83baca32026-09-30
  • R23-11rel:R23-11#759123a42026-10-14
  • R24-11rel:R24-11#4300fbe72026-10-14
  • R25-11rel:R25-11#954d5cab2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 MonotonicBufferResource [SWS_CORE_06523]

MonotonicBufferResource (void *buffer, std::size_t buffer_size, Memory Resource *upstream) noexcept;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06523
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06523@rel:R25-11#36b6c4a9
Content hash
36b6c4a9
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06523
Status: valid/unmigrated Version: rel:R25-11#18805d3b Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06523@rel:R25-11#18805d3b
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#acb6a9462026-09-30
  • R23-11rel:R23-11#f41e1e9f2026-10-14
  • R24-11rel:R24-11#ed78a94e2026-10-14
  • R25-11rel:R25-11#18805d3b2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 MonotonicBufferResource [SWS_CORE_06524]

MonotonicBufferResource () noexcept;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06524
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06524@rel:R25-11#3b581d01
Content hash
3b581d01
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06524
Status: valid/unmigrated Version: rel:R25-11#d691adfe Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06524@rel:R25-11#d691adfe
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#cdaba7a12026-09-30
  • R23-11rel:R23-11#c4b16a1a2026-10-14
  • R24-11rel:R24-11#7548fbae2026-10-14
  • R25-11rel:R25-11#d691adfe2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 MonotonicBufferResource [SWS_CORE_06525]

explicit MonotonicBufferResource (std::size_t initial_size) noexcept;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06525
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06525@rel:R25-11#b26d5246
Content hash
b26d5246
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06525
Status: valid/unmigrated Version: rel:R25-11#0e59defc Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06525@rel:R25-11#0e59defc
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#5049fb972026-09-30
  • R23-11rel:R23-11#c421df4a2026-10-14
  • R24-11rel:R24-11#d5aca05b2026-10-14
  • R25-11rel:R25-11#0e59defc2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 MonotonicBufferResource [SWS_CORE_06526]

MonotonicBufferResource (void *buffer, std::size_t buffer_size) noexcept;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06526
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06526@rel:R25-11#21d21bcc
Content hash
21d21bcc
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06526
Status: valid/unmigrated Version: rel:R25-11#f89b06c1 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06526@rel:R25-11#f89b06c1
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#2cca31c02026-09-30
  • R23-11rel:R23-11#d5cf48d92026-10-14
  • R24-11rel:R24-11#6c43aeda2026-10-14
  • R25-11rel:R25-11#f89b06c12026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 MonotonicBufferResource [SWS_CORE_06527]

MonotonicBufferResource (const MonotonicBufferResource &)=delete;

As per corresponding usage in [mem.res.monotonic.buffer]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06527
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06527@rel:R25-11#3762eacb
Content hash
3762eacb
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06527
Status: valid/unmigrated Version: rel:R25-11#16e6cac0 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06527@rel:R25-11#16e6cac0
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#a2a4321d2026-09-30
  • R23-11rel:R23-11#6632fcf42026-10-14
  • R24-11rel:R24-11#de03506d2026-10-14
  • R25-11rel:R25-11#16e6cac02026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 MonotonicBufferResource [SWS_CORE_06576] Upstream: RS_AP_00145

MonotonicBufferResource (MonotonicBufferResource &&other) noexcept=default;

[AUTOSAR defined] not present in ISO-14882. Move constructor

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe

Parameter (in)

ParameterBeschreibung
otherother MonotonicBufferResource to move from

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06576
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06576@rel:R25-11#bc89cc1a
Content hash
bc89cc1a
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06576
Status: valid/unmigrated Version: rel:R25-11#4c2df3e5 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06576@rel:R25-11#4c2df3e5
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#f24402302026-09-30
  • R24-11rel:R24-11#4990130a2026-10-14
  • R25-11rel:R25-11#4c2df3e52026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 do_allocate [SWS_CORE_06569]

void * do_allocate (std::size_t bytes, std::size_t alignment) noexcept override;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept 2. The function returns nullptr instead of (potentially) throwing a std::bad_alloc exception

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 601be17f5d68 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

类 ara::core::MonotonicBufferResource 的受保护成员函数 do_allocate 用于根据 [mem.res.monotonic.buffer] [SWS_CORE_06569] 分配内存区域。它实现了基类 ara::core::MemoryResource 的纯虚接口 do_allocate [SWS_CORE_06566]。作为解释,由于其 protected 可见性,同步调用可能主要通过基类的公共分配方法间接进行。 问题 Q-21b2da19c0fd7f8f (未决)该函数接收以字节为单位的请求大小以及所需的对齐方式(alignment)。

错误处理与异常安全性

与 C++ 标准行为相反,该函数在分配失败时不会抛出 std::bad_alloc 异常,而是返回一个 nullptr [SWS_CORE_06569]。通过带有 noexcept 的声明,该方法被指定为具有异常安全性 [SWS_CORE_06569]。因此,调用者必须始终检查结果是否为 nullptr,以检测内存不足的情况。

并发性与交互

该方法被指定为非线程安全 [SWS_CORE_06569]。如果并发地从多个线程发起分配,则必须通过调用方在外部进行同步。这与 ara::core::UnsynchronizedPoolResource::do_allocate [SWS_CORE_00058] 的行为一致,而 ara::core::SynchronizedPoolResource::do_allocate 针对并发调用被设计为线程安全的 [SWS_CORE_00061]。

本使用说明根据 AUTOSAR R25-11 规范自动生成。

实现者指南即将推出(复杂度 I1)

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe
Sichtbarkeitprotected

Rückgabewert

TypBeschreibung
void *• If successful: As per corresponding usage in [mem.res.monotonic.buffer] • If unsuccessful: the returned pointer shall be nullptr

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06569
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06569@rel:R25-11#ce1cd97d
Content hash
ce1cd97d
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06569
Status: valid/unmigrated Version: rel:R25-11#b9ee8ac6 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06569@rel:R25-11#b9ee8ac6
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#abbfa0d62026-09-30
  • R24-11rel:R24-11#59103c462026-10-14
  • R25-11rel:R25-11#b9ee8ac62026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 do_deallocate [SWS_CORE_06570]

void do_deallocate (void *p, std::size_t bytes, std::size_t alignment) noexcept override;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept 2. If unsuccessful: errors will be silently ignored

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: e7d49ed79e7c 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

类 ara::core::MonotonicBufferResource 的成员函数 do_deallocate 用于根据 [SWS_CORE_06570] 释放内存区域。它通过头文件 #include "ara/core/memory_resource.h" 定义 [SWS_CORE_06570]。该函数接收指向待释放内存区域的指针 p 以及参数 bytes 和 alignment(类型均为 std::size_t),且不返回任何返回值(void)[SWS_CORE_06570]。其语义遵循 [mem.res.monotonic.buffer] 中的规定,并带有特定的 AUTOSAR 差异 [SWS_CORE_06570]。

错误处理

该函数被声明为 noexcept 并保证异常安全性(exception safe)[SWS_CORE_06570]。如果在执行过程中发生错误,该错误将被静默忽略(errors will be silently ignored)[SWS_CORE_06570]。既不存在返回值,也不存在用于错误报告的特定错误代码。

并发性与限制

关于并发性,do_deallocate 被指定为非线程安全(not thread-safe)[SWS_CORE_06570]。在没有外部同步的情况下从多个线程同时调用是不允许的。该方法具有可见性 protected 并重写基类 ara::core::MemoryResource 的纯虚接口 [SWS_CORE_06567]。解释:调用通常可能通过基类的公共释放接口进行处理。 问题 Q-6916292acaa8993b (未决)

相互作用

虽然基类 ara::core::MemoryResource 规定释放方法具有私有可见性 [SWS_CORE_06567],但 MonotonicBufferResource 以及相关类 ara::core::SynchronizedPoolResource [SWS_CORE_00041] 和 ara::core::UnsynchronizedPoolResource [SWS_CORE_00059] 将其实现为受保护的(protected)并带有静默错误处理。与线程安全的同步池资源 [SWS_CORE_00041] 相反,MonotonicBufferResource 与 ara::core::UnsynchronizedPoolResource [SWS_CORE_00059] 一样需要排除并行访问。

本使用说明由 AI 创建,基于 AUTOSAR Adaptive R25-11 规范的规定。

实现者指南即将推出(复杂度 I1)

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe
Sichtbarkeitprotected

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06570
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06570@rel:R25-11#8cc91e12
Content hash
8cc91e12
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06570
Status: valid/unmigrated Version: rel:R25-11#f3b1bdb5 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06570@rel:R25-11#f3b1bdb5
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#46e378422026-09-30
  • R24-11rel:R24-11#19c0e1ee2026-10-14
  • R25-11rel:R25-11#f3b1bdb52026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 do_is_equal [SWS_CORE_06571]

bool do_is_equal (const MemoryResource &other) const noexcept override;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: fc4ade44f9c3 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::MonotonicBufferResource 的 protected 方法 do_is_equal 根据 [SWS_CORE_06571] 重写基类 ara::core::MemoryResource 的纯虚接口。它同步比较当前实例与传入的 const MemoryResource &other 在内存管理语义方面是否相等。

用法与语义

该调用通常通过 MemoryResource 的公共接口间接进行。根据 [SWS_CORE_06571],其行为依据 [mem.res.monotonic.buffer] 中的用法,但具有显式差异,即该函数被声明为 noexcept。返回值是一个 bool,指示两个资源是否可互换或相同。

错误处理与并发

  • 异常安全性:该函数被指定为 exception safe,且根据 [SWS_CORE_06571] 的 noexcept 签名不抛出任何异常。不存在特定的错误代码或 DET/DEM 报告。
  • 线程安全:该操作被归类为 thread-safe([SWS_CORE_06571]),可以并发执行。

相互作用

该函数实现了来自 ara::core::MemoryResource 的虚接口契约([SWS_CORE_06568])。类似相等的比较实现也可以在其他内存资源中找到,如 ara::core::SynchronizedPoolResource([SWS_CORE_00042])和 ara::core::UnsynchronizedPoolResource([SWS_CORE_00060])。

该文本由 AI 基于规范 R25-11 生成。

实现者指南即将推出(复杂度 I1)

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe
Sichtbarkeitprotected

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06571
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06571@rel:R25-11#ac522bc5
Content hash
ac522bc5
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06571
Status: valid/unmigrated Version: rel:R25-11#5dc73006 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06571@rel:R25-11#5dc73006
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#455886dc2026-09-30
  • R24-11rel:R24-11#ceb8fc942026-10-14
  • R25-11rel:R25-11#5dc730062026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 operator= [SWS_CORE_06529]

MonotonicBufferResource & operator= (const MonotonicBufferResource &)=delete;

As per corresponding usage in [mem.res.monotonic.buffer]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06529
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06529@rel:R25-11#c5b42ad1
Content hash
c5b42ad1
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06529
Status: valid/unmigrated Version: rel:R25-11#2502c929 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06529@rel:R25-11#2502c929
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#c667aa8a2026-09-30
  • R23-11rel:R23-11#65eba1772026-10-14
  • R24-11rel:R24-11#e0f799bc2026-10-14
  • R25-11rel:R25-11#2502c9292026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 operator= [SWS_CORE_06577] Upstream: RS_AP_00145

MonotonicBufferResource & operator= (MonotonicBufferResource &&other) noexcept=default;

[AUTOSAR defined] not present in ISO-14882. Move assignment operator

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe

Parameter (in)

ParameterBeschreibung
otherother MonotonicBufferResource to move from

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06577
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06577@rel:R25-11#33670d88
Content hash
33670d88
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06577
Status: valid/unmigrated Version: rel:R25-11#088d07f5 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06577@rel:R25-11#088d07f5
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#3aca8c882026-09-30
  • R24-11rel:R24-11#e89e6dab2026-10-14
  • R25-11rel:R25-11#088d07f52026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 release [SWS_CORE_06530]

void release () noexcept;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 082c843665ce 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::MonotonicBufferResource([SWS_CORE_06530])的成员函数 release() 用于释放由缓冲区资源管理的内存。该调用同步进行,不接受任何参数,且不返回任何返回值(void)。

关于错误处理,该函数被声明为 noexcept 并被指定为具有异常安全性(exception safe)([SWS_CORE_06530])。不存在特定的错误代码,也不会向中央诊断或报告实例发送错误消息。

关于并发性,release() 被显式归类为非线程安全(not thread-safe)([SWS_CORE_06530])。在没有外部同步的情况下对同一实例进行并发访问是不允许的。解释:由于借鉴了 [mem.res.monotonic.buffer] 的语义,调用该函数可能会使先前通过该资源提供的所有内存区域失效。 问题 Q-bd46bd9971926d95 (未决)

在来自 #include "ara/core/memory_resource.h" 的内存资源的交互中,该函数在并发行为上与线程安全的 ara::core::SynchronizedPoolResource::release() 不同([SWS_CORE_00037]),但与同样非线程安全的 ara::core::UnsynchronizedPoolResource::release() 行为类似([SWS_CORE_00065])。

该文本由 AI 基于 AUTOSAR R25-11 的规范要求生成。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06530
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06530@rel:R25-11#ed00b297
Content hash
ed00b297
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06530
Status: valid/unmigrated Version: rel:R25-11#69f783e0 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06530@rel:R25-11#69f783e0
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#819676212026-09-30
  • R23-11rel:R23-11#691b1b062026-10-14
  • R24-11rel:R24-11#83f3869e2026-10-14
  • R25-11rel:R25-11#69f783e02026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 upstream_resource [SWS_CORE_06531]

MemoryResource * upstream_resource () const noexcept;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 34a11a1fee7a 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::MonotonicBufferResource 的成员函数 upstream_resource() 同步返回指向类型为 MemoryResource* 的上级内存资源的指针 [SWS_CORE_06531]。该调用通过头文件 #include "ara/core/memory_resource.h" 进行,且不接受任何参数 [SWS_CORE_06531]。解释:如果实例的内部缓冲区不足以进行分配,则返回的内存资源可能会用作上级缓冲区。 问题 Q-e01e234e281bc4c6 (未决)

关于错误处理和异常安全性,该方法被声明为 noexcept 且完全具备异常安全性(exception safe)[SWS_CORE_06531]。规范中对于该纯 Getter 调用未定义诸如 DET 或 DEM 之类的特定错误代码、错误对象或诊断消息 [SWS_CORE_06531]。

关于并发性,该方法被指定为 const 以及线程安全(thread-safe)[SWS_CORE_06531]。因此,可以从多个线程并行查询指向 upstream 资源的指针,而无需外部同步。

功能语义遵循 [mem.res.monotonic.buffer] 中的规定,但具有规范性偏差:在 AUTOSAR Adaptive 标准中,该函数被显式定义为 noexcept [SWS_CORE_06531]。相关类 ara::core::SynchronizedPoolResource [SWS_CORE_00038] 以及 ara::core::UnsynchronizedPoolResource [SWS_CORE_00056] 也使用类似的接口模式来提供上级资源。

该文本由 AI 基于规范数据创建。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06531
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06531@rel:R25-11#9da84938
Content hash
9da84938
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06531
Status: valid/unmigrated Version: rel:R25-11#c0075ddb Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06531@rel:R25-11#c0075ddb
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#6499d8ca2026-09-30
  • R23-11rel:R23-11#ae18043d2026-10-14
  • R24-11rel:R24-11#888f90212026-10-14
  • R25-11rel:R25-11#c0075ddb2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 ~MonotonicBufferResource [SWS_CORE_06528]

~MonotonicBufferResource () noexcept override;

As per corresponding usage in [mem.res.monotonic.buffer] except for the following deviations: 1. The function is noexcept 2. The function is not virtual

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::MonotonicBufferResource
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06528
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06528@rel:R25-11#7a6a3fcb
Content hash
7a6a3fcb
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06528
Status: valid/unmigrated Version: rel:R25-11#cb9c3608 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06528@rel:R25-11#cb9c3608
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#91d465f22026-09-30
  • R23-11rel:R23-11#6339e5982026-10-14
  • R24-11rel:R24-11#e078b9482026-10-14
  • R25-11rel:R25-11#cb9c36082026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill