- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a very simple problem. A program like folows works on 32 bit platforms Windows and linux. On 64 bi platforms the program results in a corrupted heap. Example for the program:
************************************************
Ipp32f** x = (Ipp32f**)ippsMalloc_32f(19);
for( int i = 0; i < 19; i++ ) {
x = (Ipp32f*)ippsMalloc_32f(100);
for( int k = 0; k < 100; k++ ) {
x
}
}
for( int j = 0; j < 19; j++ ) {
if( x
ippsFree(x
x
}
}
ippsFree(x);
x = NULL;
************************************************
In the reference manual I found something like
...
Ipp32f* ippsMalloc_32f(int len);
...
Example
The following example shows how to use the function ippsMalloc_8u:
void func_malloc(void) {
Ipp8u* pBuf = ippsMalloc_8u(8*sizeof(Ipp8u));
if(NULL == pBuf)
// not enough memory
ippsFree(pBuf);
}
I can not really believe that also the sizeof(IppXYZ) has to be multiplied when calling the ippsMalloc_XYZ(...) function.
I guess the corrupted heap in my small programm is the result of the large adressroom
- on 64 bit platforms: sizeof(Ipp32f*) = 8 , sizeof(Ipp32f) = 4
- on 32 bit platforms: sizeof(Ipp32f*) = 4 , sizeof(Ipp32f) = 4
If I use
Ipp32f** x = (Ipp32f**)ippsMalloc_32f(19 * sizeof(Ipp32f*)/sizeof(Ipp32f));
instead of
Ipp32f** x = (Ipp32f**)ippsMalloc_32f(19);
the program works perfect on all platforms (32 and 64 bit).
Has anybody an idea what's going wrong?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what is the parameter 'len' referring to in ippsMalloc_XYZ(int len) function?
does it refer to "number of bytes", or "number" of elements"?
using examples on the reference: https://software.intel.com/en-us/ipp-9.0-ipps-manual-pdf
page 35:
Ipp8u* pBuf = ippsMalloc_8u(8*sizeof(Ipp8u));
seems referring to "number of bytes"
but the example on page 168:
Ipp32f *x = ippsMalloc_32f(1000), mean;
int i;
for(i = 0; i<1000; ++i) x = (float)rand() / RAND_MAX;
seemly referring to "number of elements": here 'array' x has 1000 'elements', and will take 1000*sizeof(Ipp32f), or 4000 bytes!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page