Can RTSHA works with several heaps? #3
-
Hi |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, Example: PREALLOC_MEMORY<Heap, NUM_OF_HEAPS> _heap_obj_array; _heapArray[0] = new (_heap_obj.get_next_ptr()) Heap(); _heapArray[0]>add_page(...) void ptr* mem1= _heapArray[n]->malloc(size); Best Ragards |
Beta Was this translation helpful? Give feedback.
Hi,
There is no such functions in C interfaces.
Using functions rtsha_create_heap, rtsha_add_page, rtsha_malloc ... you can use only one instance of the Heap.
If you like to use more instances, you can use C++ classes.
Example:
PREALLOC_MEMORY<Heap, NUM_OF_HEAPS> _heap_obj_array;
Heap* _heapArray[NUM_OF_HEAPS];
_heapArray[0] = new (_heap_obj.get_next_ptr()) Heap();
_heapArray[1] = new (_heap_obj.get_next_ptr()) Heap();
_heapArray[2] = new (_heap_obj.get_next_ptr()) Heap();
...
_heapArray[NUM_OF_HEAPS-1] = new (_heap_obj.get_next_ptr()) Heap();
_heapArray[0]>add_page(...)
_heapArray[0]>add_page(...)
...
_heapArray[1]>add_page(...)
...
_heapArray[1]>add_page(...)
void ptr* mem1= _heapArray[…