LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

loosing RAM by saving to file

Hallo,

I wrote an application running under Win98 which saves data every 100ms
in a file for every day (40MB per day). While the application is runnigs
the free RAM is reduced about every 100 minute for about 2,5 MB. The
system doesn't refree the RAM, if the application start a new file the
next day, or if the data a write in a new file every hour, so that the
application has not to work with so big files.

The problem doesn't occure, if I run the same application without the
write to file VI.

Anyone knows why the RAM getting less and how to solve this problem.

Thanks, Niko
0 Kudos
Message 1 of 6
(3,217 Views)
"Nikolai Maris" wrote in message
news:3D6B74C6.3527313A@ib-mut.de...
> Hallo,
>
> I wrote an application running under Win98 which saves data every 100ms
> in a file for every day (40MB per day). While the application is runnigs
> the free RAM is reduced about every 100 minute for about 2,5 MB. The
> system doesn't refree the RAM, if the application start a new file the
> next day, or if the data a write in a new file every hour, so that the
> application has not to work with so big files.
>
> The problem doesn't occure, if I run the same application without the
> write to file VI.
>
> Anyone knows why the RAM getting less and how to solve this problem.

What vi are you using to write with? Are you reopening the file everytime
without closing
it?
0 Kudos
Message 2 of 6
(3,217 Views)
At first I used the "Write character to file"-VI.
Then I used the sub VIs of "Write character to file"-VI, so that I opened the
tho file once, and use the "Write File+ (string)"-Sub-VI in a while loop and
let the file stay open. But that doesn't help.
0 Kudos
Message 3 of 6
(3,217 Views)
Sorry but I don't know why it would gobble memory. BTW, are you sure you
are writing every 100ms? I would have guessed that would not be possible.

"Nikolai Maris" wrote in message
news:3D6B991E.77235206@ib-mut.de...
> At first I used the "Write character to file"-VI.
> Then I used the sub VIs of "Write character to file"-VI, so that I opened
the
> tho file once, and use the "Write File+ (string)"-Sub-VI in a while loop
and
> let the file stay open. But that doesn't help.
>
0 Kudos
Message 4 of 6
(3,217 Views)
You should not be using the 'Write to file VI' as this opens and closes the file each time the data is saved. I have included a picture of a VI showing how to stream data to disk, so the file is opened at the start of acquisition and closed at the end. This will be a much more efficient method.

If you try this example but you are still having problems, then add a 'Flush file vi' after 'Write' into the loop (found in Functions>File I/O>Advanced File Functions>Flush file). This will write all the buffers to disk and update the directory entry. This may help you.

Kim
0 Kudos
Message 5 of 6
(3,217 Views)
If I write a simple VI that create a hudge file for example 500 kB every
second, then I loose every few minutes about 2-3 MB RAM.
I am working with Windows 98, maybe the problem doesn't occure on Windows
2000.
0 Kudos
Message 6 of 6
(3,217 Views)