Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Memory allocation

eyalk
Beginner
433 Views
Hi:

How can we allocate the memory used by the parallel_for in advance (during the constructions stage) - we try to avoid dynamic allocation as much as we can.

Thanks
0 Kudos
6 Replies
RafSchietekat
Valued Contributor III
433 Views

I don't see how you could do that, but have you seen a problem or are you just attempting possibly premature optimisation?

0 Kudos
eyalk
Beginner
433 Views
Quoting - Raf Schietekat

I don't see how you could do that, but have you seen a problem or are you just attempting possibly premature optimisation?


we try to avoid dynamic allocation because of the nature of our system. if we run parallel_for during the initialization stage of our software, would it solve the problem? would the allocation of all the needed memory would be performed than?
0 Kudos
Alexey-Kukanov
Employee
433 Views
Quoting - eyalk
we try to avoid dynamic allocation because of the nature of our system. if we run parallel_for during the initialization stage of our software, would it solve the problem? would the allocation of all the needed memory would be performed than?
it would help for some extent, but complete absence of dynamic memory allocation can not be guaranteed.
Could you say more specifically what problems you try to solve by avoiding dynamic allocation?
0 Kudos
eyalk
Beginner
433 Views
it would help for some extent, but complete absence of dynamic memory allocation can not be guaranteed.
Could you say more specifically what problems you try to solve by avoiding dynamic allocation?

One of our coding rules is trying to avoid dynamic allocation as much as we can, because during run time there is a possibility that the heap will not have enough memory to allocate. Our system can not allow this to happen (medical care system). So we try to find a way tobring down the amount of dynamic allocation in our code.
0 Kudos
RafSchietekat
Valued Contributor III
433 Views
Quoting - eyalk
One of our coding rules is trying to avoid dynamic allocation as much as we can, because during run time there is a possibility that the heap will not have enough memory to allocate. Our system can not allow this to happen (medical care system). So we try to find a way tobring down the amount of dynamic allocation in our code.
Why worry at all, it's just one patient, right, not, like, a nuclear power plant or something? A bit more seriously, I can understand using bleeding-edge technology in, say, MRI data processing, but actual medical care?
0 Kudos
Dmitry_Vyukov
Valued Contributor I
433 Views
Quoting - eyalk
How can we allocate the memory used by the parallel_for in advance (during the constructions stage) - we try to avoid dynamic allocation as much as we can.

There is no such feature in TBB.

0 Kudos
Reply