Community
cancel
Showing results for 
Search instead for 
Did you mean: 
eyalk
Beginner
79 Views

Memory allocation

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
Black Belt
79 Views

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

eyalk
Beginner
79 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?
Alexey_K_Intel3
Employee
79 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?
eyalk
Beginner
79 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.
RafSchietekat
Black Belt
79 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?
Dmitry_Vyukov
Valued Contributor I
79 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.

Reply