-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CP-492 Add documentation for setting allocation strategy
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters