hi john,

On 22.09.10 11:37, John Lato wrote:
> Initially I tried using readFileChunks, but I never got any data from it.  The
> info would print out, but the calculation of the maximum value would be 0
> because "chunks" would be an empty list.  I tried using several different
> numbers for the first argument to readFileChunks, such as 1, 2, 8, and 1024 
> (is
> it the number of frames to read?), but always received an empty list.  Could 
> any
> point me to what I'm doing wrong?  This is with ghc-6.12.1.

you're not doing anything wrong; i think the reason is that the way readChunks
is implemented the file handle is closed prematurely. this function needs to be
removed from the interface.

> Now it works and reports the proper answer, but when I run the program with 
> +RTS
> -s it shows low memory usage.  Very low.
> 
>           40,488 bytes allocated in the heap
>            1,484 bytes copied during GC
>            6,124 bytes maximum residency (1 sample(s))
>           14,356 bytes maximum slop
>                1 MB total memory in use (0 MB lost due to fragmentation)
> 
> However, the system monitor shows that the program is occupying about 230MB of
> RAM.  For my test file the this program reports:
> 
> Info {frames = 17479453, samplerate = 44100, channels = 2, format = Format
> {headerFormat = HeaderFormatWav, sampleFormat = SampleFormatPcm16, 
> endianFormat
> = EndianFile}, sections = 1, seekable = True}
> 
> so 230MB seems consistent with allocating a single vector of Doubles.
> 
> So my second question is, why is this memory usage not reported by +RTS -s, 
> or -hT?

i'm not sure either, maybe because the memory is allocated on the heap by
malloc? this might indicate a memory leak, i'll investigate. i'm currently on
the road and won't have the time to look into the problem before sunday ...

<sk>
_______________________________________________
haskell-art mailing list
[email protected]
http://lists.lurk.org/mailman/listinfo/haskell-art

Reply via email to