03-29-2011 04:10 PM
Solved! Go to Solution.
03-30-2011 06:44 AM
Hi Norbert,
right now I'm not sure what leads to this behavior but you can try two things.
1. What happens in release mode?
2. What happens if you use calloc instead of malloc? (see link)
http://digital.ni.com/public.nsf/websearch/119E4AA17E0A6F9C86256C4E00568121?OpenDocument
03-30-2011 07:37 AM
If you have the Debugging level set to Extended in the Build Options, I know the debugger does some extra stuff when it comes to dynamically allocated memory. That could be what's slowing down the build.
03-30-2011 08:43 AM
Norbert,
Assuming you are iterating over all the elements in the 1st four vectors of the array then you are potentially calling malloc 69.4 million times. This will always be tremendously slower than 1 large allocation. There are also a few bytes of overhead for each pointer that you allocate so you might not be saving any memory unless your hashtable is almost empty.
Michael
NI
04-01-2011 02:42 AM
Hi,
thank you all for trying to help!
@niceday:
04-01-2011 10:59 AM
When CVI compiles the file in a Debug config with the debugging level set to Standard or Extended then we allocate user protection data to track the state of each pointer in the array. For each of the 69 million pointer values we are allocating data to be added to your executable for run-time checking. These allocations are causing the apparant hang.
There are multiple ways to prevent CVI from allocating all of this additional data.
1) Change the debugging level to 'No run-time checking'.
2) Change the base type of the array from 'char *' to 'size_t'. You would also need to add a cast to every reference of the array elements.
3) Select the 'Enable .Obj option' option for the file that contains the definition of the array. This disables all debugging for that .c file.
3b) Move the declaration of the array to it's own .c file and select the 'Enable .obj option' that that .c file instead of the .c file that contains all of the source that uses the array.
Even if you only need 70 megs for the dynamically allocated strings, you still need 265 megs to store the array of 69 million pointers.
-Michael
04-05-2011 02:06 AM
Thank you Michael,
i think i take the 'Enable .Obj option'
Norbert