Guarded allocator: Ensure alignment and size of MemHead #120582

Merged
Sergey Sharybin merged 3 commits from Sergey/blender:guardedalloc_ensure_memhead_alignment into main 2024-04-12 17:22:57 +02:00

Ensure that the MemHead and MemHeadAligned are such that memory
allocation followed with the head offset keeps the allocation
aligned to at least MEM_MIN_CPP_ALIGNMENT.

Ensure that the MemHead and MemHeadAligned are such that memory allocation followed with the head offset keeps the allocation aligned to at least MEM_MIN_CPP_ALIGNMENT.
Sergey Sharybin added 1 commit 2024-04-12 16:52:07 +02:00
Guarded allocator: Ensure alignment and size of MmeHead
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
5b84fcb760
Ensure that the MemHead and MemHeadAligned are such that memory
allocation followed with the head offset keeps the allocation
aligned to at least MEM_MIN_CPP_ALIGNMENT.
Sergey Sharybin requested review from Hans Goudey 2024-04-12 16:52:16 +02:00
Sergey Sharybin requested review from Jacques Lucke 2024-04-12 16:52:20 +02:00
Hans Goudey changed title from Guarded allocator: Ensure alignment and size of MmeHead to Guarded allocator: Ensure alignment and size of MemHead 2024-04-12 16:53:12 +02:00
Author
Owner

@blender-bot build

@blender-bot build
Hans Goudey requested changes 2024-04-12 16:57:07 +02:00
@ -258,6 +258,10 @@ void MEM_use_guarded_allocator(void);
# include <type_traits>
# include <utility>
# define MEM_MIN_CPP_ALIGNMENT \
Member

There should be a comment describing what this means IMO. That would make the static asserts more meaningful too

There should be a comment describing what this means IMO. That would make the static asserts more meaningful too
Author
Owner

That is a good point. Tried my best to explain what it is.

That is a good point. Tried my best to explain what it is.
Jacques Lucke approved these changes 2024-04-12 16:58:34 +02:00
Sergey Sharybin added 1 commit 2024-04-12 17:03:22 +02:00
Hans Goudey approved these changes 2024-04-12 17:14:40 +02:00
@ -259,2 +259,4 @@
# include <utility>
/* Conservative value of memory alignment returned by non-aligned OS-level memory allocation
* functions. */
Member

How about adding For alignments smaller than this value, using non-aligned versions of allocator API functions is okay, allowing use of calloc, for example.

How about adding `For alignments smaller than this value, using non-aligned versions of allocator API functions is okay, allowing use of calloc, for example.`
Author
Owner

Sounds good to me!

Sounds good to me!
Sergey Sharybin added 1 commit 2024-04-12 17:16:50 +02:00
Sergey Sharybin merged commit a4b36cd0d5 into main 2024-04-12 17:22:57 +02:00
Sergey Sharybin deleted branch guardedalloc_ensure_memhead_alignment 2024-04-12 17:22:59 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#120582
No description provided.