- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Experts,
I am doing some experiments with TBB. I read that TBB allocator will use thread specific heaps. I suppose this is a pool of freememory allocated from global heap andkeptspecifically foreach threads.My program allocates memory using scalable_malloc indifferent threads (TBB threads) butmemory is released in one of the threads. It is basically a pipeline processing .So the parallel filters allocate memory and a serial filter deallocates. Now I got following doubts.
1. Will the scalable_free return it to correct thread specific heap ?. If so how it does that ?. By looking some address range ?
2. WillThreads created by TBBbe alive till the end of the program so that thread never dies and the corresponding heap is alwaysaccessable?.
Thanks
Zooli
Thanks
I am doing some experiments with TBB. I read that TBB allocator will use thread specific heaps. I suppose this is a pool of freememory allocated from global heap andkeptspecifically foreach threads.My program allocates memory using scalable_malloc indifferent threads (TBB threads) butmemory is released in one of the threads. It is basically a pipeline processing .So the parallel filters allocate memory and a serial filter deallocates. Now I got following doubts.
1. Will the scalable_free return it to correct thread specific heap ?. If so how it does that ?. By looking some address range ?
2. WillThreads created by TBBbe alive till the end of the program so that thread never dies and the corresponding heap is alwaysaccessable?.
Thanks
Zooli
Thanks
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> 2. WillThreads created by TBBbe alive till the end of the program so
that thread never dies and the corresponding heap is alwaysaccessable?
You don't need it to be alive till the end of the program, you need it to be alive so long to not cause any faults. And of course it's alive so long to not cause any faults. Otherwise it would be completely unusable.
> 1. Will the scalable_free return it to correct thread specific heap ?. If so how it does that ?. By looking some address range ?
Yes, it will. For blocks allocated via slab allocator it should look like:
super_block_t* sb = (super_block_t*)((uintptr_t)p & ~(super_block_alignment - 1));
thread_t* owner = sb->owner;
You don't need it to be alive till the end of the program, you need it to be alive so long to not cause any faults. And of course it's alive so long to not cause any faults. Otherwise it would be completely unusable.
> 1. Will the scalable_free return it to correct thread specific heap ?. If so how it does that ?. By looking some address range ?
Yes, it will. For blocks allocated via slab allocator it should look like:
super_block_t* sb = (super_block_t*)((uintptr_t)p & ~(super_block_alignment - 1));
thread_t* owner = sb->owner;
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page