Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ken Brody <kenbrody@spamcop.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: trouble of static working-data-buffers size assumption |
| Date | 2015-08-10 13:05 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <mqalim$298$1@dont-email.me> (permalink) |
| References | <7654f359-9404-4818-a877-b3a0d5c32d05@googlegroups.com> <b292d473-024c-465c-917e-54bc594ec37b@googlegroups.com> |
On 8/10/2015 10:48 AM, fir wrote: > W dniu poniedziałek, 10 sierpnia 2015 16:42:17 UTC+2 użytkownik fir napisał: > > errata, should be : >> as this is usuall trade off - esability of > working on it against more >> work and unfaliability > > yet ona advantage of static buffers (aside to mentioned simplicity and speed) is that realloc cannot fail (this is important as i seen many apps not ready for working with no more ram condition, and that was unpleasant, > app workng on static buffers would probably > run further (if system would not break on its side) ) Well, if realloc() fails because of insufficient memory, what makes you think that there's enough memory for the largest-possible static buffer? I usually just use malloc/realloc, and keep track of my current allocation size. I then have a quick to see if the current buffer is big enough, and realloc if not, storing the new size. (Sometimes, I'll realloc to X bytes larger than the currently-required amount, to reduce realloc calls and possible memory fragmentation.) No matter how big you make the static buffer, there will be some scenario where it's not large enough. What do you do then? -- Kenneth Brody
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
trouble of static working-data-buffers size assumption fir <profesor.fir@gmail.com> - 2015-08-10 07:42 -0700
Re: trouble of static working-data-buffers size assumption fir <profesor.fir@gmail.com> - 2015-08-10 07:48 -0700
Re: trouble of static working-data-buffers size assumption Ken Brody <kenbrody@spamcop.net> - 2015-08-10 13:05 -0400
Re: trouble of static working-data-buffers size assumption fir <profesor.fir@gmail.com> - 2015-08-10 10:21 -0700
Re: trouble of static working-data-buffers size assumption fir <profesor.fir@gmail.com> - 2015-08-10 10:52 -0700
Re: trouble of static working-data-buffers size assumption fir <profesor.fir@gmail.com> - 2015-08-10 11:25 -0700
Re: trouble of static working-data-buffers size assumption Ken Brody <kenbrody@spamcop.net> - 2015-08-11 11:25 -0400
Re: trouble of static working-data-buffers size assumption Richard Damon <Richard@Damon-Family.org> - 2015-08-10 22:36 -0400
Re: trouble of static working-data-buffers size assumption Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-10 22:54 -0700
Re: trouble of static working-data-buffers size assumption Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-11 13:41 +0100
Re: trouble of static working-data-buffers size assumption Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-11 08:27 -0700
Re: trouble of static working-data-buffers size assumption David Brown <david.brown@hesbynett.no> - 2015-08-10 18:22 +0200
csiph-web