Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: I want to ask a question... |
| Date | 2015-08-20 22:58 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <mr5evc$24a$1@dont-email.me> (permalink) |
| References | (6 earlier) <lnio8a3akw.fsf@kst-u.example.com> <mr5043$gfe$1@speranza.aioe.org> <mr514a$688$1@dont-email.me> <slrnmtc48b.vvc.tTh@hangartistique.cispeo.fr> <mr59jh$b5v$1@dont-email.me> |
On 20/08/15 21:27, James Kuyper wrote: > On 08/20/2015 01:40 PM, Tonton Th wrote: >> On 2015-08-20, James Kuyper <jameskuyper@verizon.net> wrote: >> >>> Why? It's undefined behavior either way, if the the pointer has an >>> indeterminate value, and the standard was written that way because there >>> are real systems on which comparison of a pointer with and indeterminate >>> value could have nasty consequences. >> >> Can you give us a real (and may be historic) exemple of >> some systems where this is the case ? > > I remember systems with unusual features mainly for the purpose of > remembering that those features actually exist, so I tend not to > remember the corresponding system names, so I can't name it. > However, I can describe the features the system had that made this a > problem, and maybe someone will recognize the description. It had a > virtual memory system, with ranges of address space being associated > with an arbitrary blocks of physical memory. It kept track of which > range of addresses was associated with each block of memory currently in > use, and trapped upon any attempt to use an address (even just in a > comparison for equality) not currently allocated to any physical block > of memory. Calling free() could result in a block being removed from the > list of blocks currently in use. > It's that last feature that is, apparently, the least common - I've been > told that most implementations of the malloc() family don't actually > release memory back to the system until the program exits, which seems > like rather selfish behavior to me. > I believe it is common for malloc implementations to ask the OS for large chunks of memory, then dish out parts of that as needed by the program. This way they only bother the OS on occasion, and the overhead for malloc is much smaller (there are no context switches or system calls for most allocations). Memory can only be returned to the OS if a whole chunk has been freed - and if the program has a mix of malloc's and free's, that is rarely going to happen. It needs a program that has allocated a substantial amount of memory, freed it, and then continues running for a significant time without re-using that memory space. Maybe it is simply not worth the overhead supporting this.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: I want to ask a question... Gareth Owen <gwowen@gmail.com> - 2015-08-07 20:00 +0100
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-07 19:04 +0000
Re: I want to ask a question... Keith Thompson <kst-u@mib.org> - 2015-08-07 15:30 -0700
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-07 22:52 +0000
Re: I want to ask a question... Keith Thompson <kst-u@mib.org> - 2015-08-07 16:46 -0700
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-07 23:29 +0000
Re: I want to ask a question... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-08 01:37 +0100
Re: I want to ask a question... Keith Thompson <kst-u@mib.org> - 2015-08-07 18:55 -0700
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-08 05:51 +0000
Re: I want to ask a question... Robert Wessel <robertwessel2@yahoo.com> - 2015-08-08 01:44 -0500
Re: I want to ask a question... Ken Brody <kenbrody@spamcop.net> - 2015-08-10 12:46 -0400
Re: I want to ask a question... supercat@casperkitty.com - 2015-08-19 16:43 -0700
Re: I want to ask a question... Keith Thompson <kst-u@mib.org> - 2015-08-19 18:09 -0700
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-20 01:00 +0000
Re: I want to ask a question... Keith Thompson <kst-u@mib.org> - 2015-08-19 20:25 -0700
Re: I want to ask a question... supercat@casperkitty.com - 2015-08-20 08:15 -0700
Re: I want to ask a question... Keith Thompson <kst-u@mib.org> - 2015-08-20 11:38 -0700
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-20 18:47 +0000
Re: I want to ask a question... supercat@casperkitty.com - 2015-08-20 14:01 -0700
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-20 16:43 +0000
Re: I want to ask a question... James Kuyper <jameskuyper@verizon.net> - 2015-08-20 13:02 -0400
Re: I want to ask a question... Tonton Th <tTh@nowhere.invalid> - 2015-08-20 17:40 +0000
Re: I want to ask a question... James Kuyper <jameskuyper@verizon.net> - 2015-08-20 15:27 -0400
Re: I want to ask a question... David Brown <david.brown@hesbynett.no> - 2015-08-20 22:58 +0200
Re: I want to ask a question... James Kuyper <jameskuyper@verizon.net> - 2015-08-20 23:24 -0400
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-21 06:19 +0000
Re: I want to ask a question... Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-08-21 09:20 -0600
Re: I want to ask a question... supercat@casperkitty.com - 2015-08-22 12:25 -0700
Re: I want to ask a question... Robert Wessel <robertwessel2@yahoo.com> - 2015-08-23 01:33 -0500
Re: I want to ask a question... glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-20 19:28 +0000
Re: I want to ask a question... Keith Thompson <kst-u@mib.org> - 2015-08-20 12:11 -0700
Re: I want to ask a question... David Brown <david.brown@hesbynett.no> - 2015-08-20 10:02 +0200
Re: I want to ask a question... raltbos@xs4all.nl (Richard Bos) - 2015-08-22 13:42 +0000
Re: I want to ask a question... supercat@casperkitty.com - 2015-08-22 12:23 -0700
csiph-web