LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

500 cycles in a LV for loop, a c dll function can't open files anymore. why?

I use a c dll function that opens many files. The dll is called in a LabVIEW for loop. When I execute the for loop, after around 500 cycles, the dll function can't open the files anymore without indicating any kind of error. I will have to close and reopen LabVIEW in order to be able to open the files again in the dll function. I would appreciate it if someone could help with this... thanks
0 Kudos
Message 1 of 12
(3,526 Views)
Do you close the refernces to file after they have been opened.

Thanks,
Naresh
0 Kudos
Message 2 of 12
(3,526 Views)
Yes, the dll function opens the file references at the beginning and closes them at the end.

Do you have any idea why this could be happening?

Thanks
0 Kudos
Message 3 of 12
(3,526 Views)
Their seems some where a memory leak.

Try opening only one file from the dll and find out which file is causing the problem.
Also monitor the task manager to see how the memory is increasing, when you are looping.

Thanks,
Naresh
0 Kudos
Message 4 of 12
(3,526 Views)
rtyu,

If it is a memory leak, the task manager should show this behaviour just as Naresh suggested. Is the error generated for some specific file every time you run it ? Could you please send an example of a code which can reproduce the error.

Arkadiusz Roszczewski
National Instruments
0 Kudos
Message 5 of 12
(3,526 Views)
Hey Naresh,
after around 512 cycles in the loop all files in the dll stop opening. Also the task manager doesn't show any kind of memory error or violation.

thanks for your fast replies
0 Kudos
Message 6 of 12
(3,526 Views)
I'll try to send an example shortly..
I just have to see with my supervisor first to check for confidentiality issues...

thanks
0 Kudos
Message 7 of 12
(3,526 Views)
Also there is no error generated. all files stop opening for some reason and i will have to close LabView completely and run it again to be able to open the files for another 512 loop cycles approximately...
0 Kudos
Message 8 of 12
(3,378 Views)
Entire function is not in fact required. Please prepare just a short fragment of a code which opens files, closes them and produces the same behaviour.
Try to get rid of any line of the code which is not important in our example.

Arkadiusz Roszczewski
National Instruments
0 Kudos
Message 9 of 12
(3,526 Views)
Hi,

Some questions that might be interesting...

Do you get the same result when you put the VI in continues run (without the
for loop)? LV cleans things up when a vi stops running, and sometimes
continuous run is different to using a for loop.

Is the number of iterations always exactly 512? If so, it's probably no
coincidence. 512 is exactly 9 bits, and it looks like the dll has an static
array filled with references. When element 513 is filled, some other data
might be overwritten, or even code. Normally this should not happen, but
since it's not a normal problem...

Regards,

Wiebe.


"rtyu" wrote in message
news:506500000005000000BB720100-1079395200000@exchange.ni.com...
> Also there is no error generated. all files stop openi
ng for some
> reason and i will have to close LabView completely and run it again to
> be able to open the files for another 512 loop cycles approximately...
0 Kudos
Message 10 of 12
(3,378 Views)