Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6814 Discussions

Mixing memory allocation with IPP and standard C malloc

binjian
Beginner
709 Views
Hello everyone,

I don't know much about the difference among memory allocation with ipp function, standard function or with c++ "new". Maybe a primitive question:

I use IPP function (ippsMalloc_8u in this case) to allocate memories for a signal signal structure. On other places of the programm the standard C malloc is used again and STL objects like stack, queue are also used. I must say quite chaoticSmiley with tongue out [:-P]

Then the error will occur after the programm runs for a while and allocation and free memory with the hybrid methods are executed for many times. The programm will stop at the line of allocating memory with ippsMalloc_8u or sometimes at "new". It seems rather random as to where and when it happens. I am sure that I free properly all the memories I allocated.
So I doubt it's maybe not allowed to mix memory allocation modes massively. Is there any such cautions as to Ipp allocation?

The version I used is Ipp4.0. Does anyone has a similar question and can help out?
Thanks
0 Kudos
3 Replies
Vladimir_Dudnik
Employee
709 Views

Hello,

the rule is simple:

always use appropriate pair of funtion for allocating/delete memeory blocks. If some block was allocated with ippMalloc - you need to use ippFree to delete block, if block was allocated with CRT malloc/new call you need to use CRT free/delete functions. Never mix allocation/deleting API and you will have no problem (if you have no dynamic memory overruns in code).

BTW, why did not you upgrade to IPP 5.1 (or IPP 5.2 beta, which is the latest availbale version)?

Regards,
Vladimir

0 Kudos
binjian
Beginner
710 Views
Hello Vladimir,

thank you very much for your quick reply. It's all I want to know that there's no special rule for IPP allocation.

We bought IPP 4.0 two years ago. Since then we've been satisfied with our version as to the part we needed. Anyway I'll take a look at the IPP 5.2.

Regards,
Binjian
0 Kudos
Vladimir_Dudnik
Employee
710 Views
Great, you are welcome :)
0 Kudos
Reply