Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-492 Add documentation for setting allocation strategy #1857

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/manual/config/allocation-config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. _allocation_config:

*********************
Memory Allocation Configuration
*********************

Users have the flexibility to customize the memory allocation strategy for |var-project| by leveraging their own memory allocation libraries. To utilise your preferred memory allocation functions, follow these steps:

1. Include `dds/ddsrt/heap.h`
To gain access to `ddsrt_allocation_ops_t` and `ddsrt_set_allocator`.

2. Set the allocation operations
Define a `ddsrt_allocation_ops_t` structure that contains pointers to the functions you want to use for memory allocation and deallocation (`malloc`, `calloc`, `realloc`, and `free`).

3. Provide `ddsrt` the operations
Utilize the `ddsrt_set_allocator` function to set the ops chosen in step 2.

4. Link with custom library
Compile and link your application with the library that contains the functions specified in the `ddsrt_allocation_ops_t` structure created in step 2.

By following these steps, you can tailor the memory allocation mechanism of |var-project| to meet your specific requirements.
1 change: 1 addition & 0 deletions docs/manual/config/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ To determine the information included in the log file, change the :ref:`Tracing/
conformance
config_file_reference
benchmarking
allocation-config