Re: fopen and memory usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> No, it doesn't. What purpose would that serve?  It will cost you a
>> buffer
>> for the I/O (perhaps 8192 bytes) and a FILE control structure.
>
> If I remember rightly its nearer 64K nowdays simply because disks are
> faster, memory is cheaper and its a good buffer size.
>
> Basically the C library will make an intelligent decision on buffering
> which you should assume is right exept in very special cases. That value
> may change depending on library version, kernel, system memory, OS and a
> million other things but its there in the library to save you having to
> worry about it in the app.
>
> If you need to do specific buffering see "man setbuf"

Thank you for your replies.  I think I have a clear understanding of what
is going on but let me air what I think, then you can tell me how stupid I
am.  :)

Okay, so I use fopen and it gives me a stream.  Now when I call fread (say
for 100K) on my large file (2G) it will try to read the first 64K
regardless of size and populate *ptr.  If size is larger than 64K (100K
here) it will then read another 64K?  Does it use the same buffer space
(effectively only using 64K) and is that buffer space outside the memory
footprint of my application?

Again, thank you for all of your help.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux