I am using ippiMalloc to allocate memory for an image. When (width, height) are within some (usually small) ranges, ippiMalloc returns a NULL pointer, indicating that it was unable to allocate the memory. The error appears consistently and is reproducible in a certain context but not in others.
An odd thing is that the allocation works for values that do not lie within the range. An example:
1. Allocating (1, 1) is successful.
2. Allocating (50, 50) returns a NULL pointer => is unsuccessful.
3. Allocating (1000, 1000) is successful.
The problem is seen regardless of the order of the allocations and how many times the allocations are performed.
This is using version 5.2 of IPP. ippiMalloc is being called from managed .NET code using P/Invoke with the following import statement:
private static extern IntPtr ippiMalloc_8u_C1(int widthPixels, int heightPixels, out int stepBytes);
The program is running on Windows Vista 32-bit on a Core 2 Duo T7300.
Are we doing something wrong or is it to be expected that the allocation fails? I could understand if there was not a sufficiently large contiguous block of memory available for the allocation, but we can repeatedly allocate both larger and smaller blocks.