Deutsch English Français Italiano |
<v4q5c7$t6bd$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: realloc() - frequency, conditions, or experiences about relocation? Date: Mon, 17 Jun 2024 13:12:54 -0700 Organization: A noiseless patient Spider Lines: 41 Message-ID: <v4q5c7$t6bd$2@dont-email.me> References: <v4ojs8$gvji$1@dont-email.me> <875xu8vsen.fsf@bsb.me.uk> <v4ovqf$j5hq$1@dont-email.me> <87zfrjvqp6.fsf@bsb.me.uk> <v4pb4v$lhgk$1@dont-email.me> <gXZbO.32804$Kxzd.2258@fx15.iad> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 17 Jun 2024 22:12:56 +0200 (CEST) Injection-Info: dont-email.me; posting-host="c5aa21a2ffdc11ceb19a167156cbaefd"; logging-data="956781"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19R5y7GSA0vK7hlE5IobJSnvtEbXDc1BUQ=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:DPM1zLWSVFJujfc2Ft7sxTt8bas= Content-Language: en-US In-Reply-To: <gXZbO.32804$Kxzd.2258@fx15.iad> Bytes: 2639 On 6/17/2024 9:58 AM, Scott Lurndal wrote: > Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes: >> On 17/06/2024 10:55, Ben Bacarisse wrote: >>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes: >>> > >>> >>> I have no idea what you are talking about. What "value" are you looking >>> to calculate? >>> >> We have a continuously growing buffer, > > At this point, you should be asking yourself > if there are better alternatives for storing > the incoming data than to a continuously growing > dynamically allocated piecemeal buffer. > > C character stdio tends to work well for streaming applications > (i.e. pipelines where the input is (minimally) processed and forwarded > to the output), but not so efficiently for applications that need to > look at the data en masse. Indeed. > Personnally, I'd mmap the input file and eschew stdio completely > and just walk through memory with the appropriate pointer. That works for sure. Actually, its been a while since I have used memory mapped files. I made a little database thing with them that multiple processes could use, lock-free... ;^) Also, I remember a nifty trick to use memory mapped files with certain lock-free algorithms. I need to find that old post over on comp.programming.threads. Have a feeling that its going to be hard to find! > (mmap showed up in the late 80s, so you can pretend it > is C90 if you like).