07-14-2011 04:00 AM
Hi,
I am calling a function from labwindows/CVI dll in one of the sequence step in teststand.The library "UlinkClient",read the data from a file and stores it in a array.There are few2 D arrays defines to acheieve this in the dll Code.
The sequcne step is failing and says "Error -17004, could not load library/dll.".
I noticed that when I reduce the size of the array defined in the dll,this error goes off.Can someone please suggest me how I can eliminate this problem.Does Teststand have any constarints on the dll memory size?If yes how this can be increased?
07-14-2011 09:30 AM
If your arrays are on the order of 100's of megs you might be hitting address space limitations of 32-bit processes. It's hard to find contiguous blocks of memory in the 100's of megs range in a 32-bit process. If you can use fewer or smaller arrays you might be able to avoid the problem.
-Doug
07-14-2011 11:05 PM
The following are the arrays defined :
#define max_num_blocks 255
#define max_block_size 90
#define Block_Name_Size 90
#define max_bit_size 256
#define max_item_size 256
#define max_port 14
char Project_Name[Block_Name_Size];
int Num_of_blocks[max_port];
int Total_num_blocks[max_port];
int Block_Num[max_port][max_num_blocks];
int Block_Type[max_port][max_num_blocks];
int Block_Size[max_port][max_num_blocks];
int Block_Reply_Bytes[max_port][max_num_blocks];
int Block_Item_type[max_port][max_num_blocks][max_block_size];
long Block_Item_Val[max_port][max_num_blocks][max_block_size];
char Block_Item_Name[max_port][max_num_blocks][max_block_size][Block_Name_Size];
char Block_Name[max_port][max_num_blocks][Block_Name_Size];
int Block_Item_Bit[max_port][max_num_blocks][max_block_size][max_bit_size];
int Block_Item_Bit_Val[max_port][max_num_blocks][max_block_size][max_bit_size];
int Block_Item_Bit_Loc[max_port][max_num_blocks][max_block_size][max_bit_size];
char Block_Item_Bit_Name[max_port][1024][Block_Name_Size];
I cannot afford to reduce the array sizes.Is there any other solution to this problem.
07-15-2011 10:27 AM
Just this parameter (Block_Item_Bit_Loc) is 93 megabytes. It looks like there is not enough memory to allocate to call your function.
07-15-2011 11:05 AM - edited 07-15-2011 11:05 AM
Are these data structures generally very sparsely used? If so, rather than allocate all of the memory you could ever possibly need upfront, it might be more efficient to allocate things dynamically when you actually need them. For example, you could have list of ports where you only add the ports when they are actually in use, and where each element in the list is structure that has a list of blocks that are only added when used, etc. I think there are some CVI libraries to help you abstract allocating lists and list elements.
Also, I think you might be allocating a lot more space than you need. For example, do you really have a separate unique 4-byte integer for every combination of portnumber, blocknumber, blockbit, and blocksubbit? What is this array for? It's very easy to end up using huge amounts of memory with high-dimension arrays.
Hope this helps,
-Doug