Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5359

ListPreAllocate limitations?

$
0
0

I am using ListTypes in LabWindows/CVI 2015 15.0.0 (413).  Windows 7

 

When attempting to use the ListPreAllocate() function I am seeing what appears to be an undocumented limit to the pre cache memory that can be allocated.

 

I understand the requirements of contiguous available space for [m][c][re]alloc to succeed, and I suspect the same is true for initial allocation using ListPreAllocate.  So In the following code, I added a calloc statement to see if it would also fail.  It did not.  So, while I can allocate memory equivalent to 30 list items using malloc, the call to ListPreAllocate fails:

 

struct SCRIPT, has sizeof(SCRIPT) of approximately 8K. 

 

    char *buf = malloc(262080);//size equivalent to 30 * sizeof(SCRIPT)
    if(!buf) return -1;
    
    ListType list1;
    list1 = ListCreate(sizeof(SCRIPT));
    if(ListPreAllocate(list1, 30*sizeof(SCRIPT)) == 0) return -1;//fails here, whether or not the malloc call above is called.

I also observed that 25*sizeof(SCRIPT) was successful.

Is there a designed limit to the memory that can be allocated using this function?

Or some parameter that needs to be set?

 

 


Viewing all articles
Browse latest Browse all 5359

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>