Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.electronics.design > #482841
| Subject | Re: Paper on dynamic memory allocation for real-time systems |
|---|---|
| Newsgroups | sci.electronics.design |
| References | (1 earlier) <osihhn$r04$2@dont-email.me> <85uqucp76e1m9j14ito1m9kqr5fnukkg2o@4ax.com> <f58bpmFc0q0U1@mid.individual.net> <juDHB.117981$uZ4.67324@fx43.am4> <f5a5o9Fp8ffU2@mid.individual.net> |
| From | Tom Gardner <spamjunk@blueyonder.co.uk> |
| Message-ID | <deXHB.16265$Dz7.12070@fx29.am4> (permalink) |
| Organization | virginmedia.com |
| Date | 2017-10-25 08:40 +0100 |
On 25/10/17 01:55, Sylvia Else wrote: > On 24/10/2017 8:12 PM, Tom Gardner wrote: >> On 24/10/17 09:26, Sylvia Else wrote: >>> On 23/10/2017 4:17 PM, upsidedown@downunder.com wrote: >>> >>>> I have often wondered, why C-programmers are so keen of using dynamic >>>> memory allocation instead of stack allocation. Is it because some >>>> early processors had a very limited stack, typically intended only for >>>> return addresses ? >>> >>> Very often one's using dynamic memory exactly because one wants it to persist >>> after the function returns. Otherwise, unless the memory requirement is large, >>> or of unknown size (at time of programming), one uses an automatic variable >>> stack allocated variable. >> >> I'm unconvinced. Persisting a variable after a function >> returns can be satisfactorily achieved either by allocating >> it in any of the calling functions "further up" the stack, >> or failing that as a global. >> >> Dynamic memory is necessary when the number of such variables >> cannot be determined at compile time. >> > > A fairly typical scenario is parsing a hierarchical data stream which may > something as relatively simple as XML, or may be the text of a program in a > high-level language such as C. > > The number and nature of the elements cannot be determined in advance of the > parsing (which tends to be recursive), so it is not practical to allocate them > further up the stack. Just so. And the key point w.r.t. using a heap is that the number cannot be determined at compile time, not their lifetime.
Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-19 12:44 -0400
Re: Paper on dynamic memory allocation for real-time systems Cursitor Doom <curd@notformail.com> - 2017-10-22 16:38 +0000
Re: Paper on dynamic memory allocation for real-time systems Bill Martin <wwm@wwmartin.net> - 2017-10-22 10:59 -0700
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-22 14:01 -0400
Re: Paper on dynamic memory allocation for real-time systems Bill Martin <wwm@wwmartin.net> - 2017-10-22 11:09 -0700
Re: Paper on dynamic memory allocation for real-time systems pcdhobbs@gmail.com - 2017-10-22 11:16 -0700
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-22 14:26 -0400
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-22 14:30 -0400
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-22 14:23 -0400
Re: Paper on dynamic memory allocation for real-time systems Cursitor Doom <curd@notformail.com> - 2017-10-22 22:49 +0000
Re: Paper on dynamic memory allocation for real-time systems pcdhobbs@gmail.com - 2017-10-22 16:15 -0700
Re: Paper on dynamic memory allocation for real-time systems upsidedown@downunder.com - 2017-10-23 08:17 +0300
Re: Paper on dynamic memory allocation for real-time systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-10-23 09:21 +0100
Re: Paper on dynamic memory allocation for real-time systems David Brown <david.brown@hesbynett.no> - 2017-10-23 11:33 +0200
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-23 12:00 -0400
Re: Paper on dynamic memory allocation for real-time systems David Brown <david.brown@hesbynett.no> - 2017-10-24 10:19 +0200
Re: Paper on dynamic memory allocation for real-time systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-10-24 10:08 +0100
Re: Paper on dynamic memory allocation for real-time systems David Brown <david.brown@hesbynett.no> - 2017-10-24 11:31 +0200
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-24 16:48 -0400
Re: Paper on dynamic memory allocation for real-time systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-10-25 00:49 +0100
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-24 20:04 -0400
Re: Paper on dynamic memory allocation for real-time systems Joseph Gwinn <joegwinn@comcast.net> - 2017-10-24 16:46 -0400
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-23 10:53 -0400
Re: Paper on dynamic memory allocation for real-time systems David Brown <david.brown@hesbynett.no> - 2017-10-24 10:29 +0200
Re: Paper on dynamic memory allocation for real-time systems upsidedown@downunder.com - 2017-10-24 15:55 +0300
Re: Paper on dynamic memory allocation for real-time systems upsidedown@downunder.com - 2017-10-24 15:56 +0300
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-23 12:35 -0400
Re: Paper on dynamic memory allocation for real-time systems Sylvia Else <sylvia@not.at.this.address> - 2017-10-24 19:26 +1100
Re: Paper on dynamic memory allocation for real-time systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-10-24 10:12 +0100
Re: Paper on dynamic memory allocation for real-time systems Sylvia Else <sylvia@not.at.this.address> - 2017-10-25 11:55 +1100
Re: Paper on dynamic memory allocation for real-time systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-10-25 08:40 +0100
Re: Paper on dynamic memory allocation for real-time systems Jasen Betts <jasen@xnet.co.nz> - 2017-10-25 05:58 +0000
Re: Paper on dynamic memory allocation for real-time systems Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-10-25 08:42 +0100
Re: Paper on dynamic memory allocation for real-time systems kevin93 <kevin@whitedigs.com> - 2017-10-25 07:29 -0700
Re: Paper on dynamic memory allocation for real-time systems Jasen Betts <jasen@xnet.co.nz> - 2017-10-28 19:49 +0000
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-25 17:28 -0400
Re: Paper on dynamic memory allocation for real-time systems David Brown <david.brown@hesbynett.no> - 2017-10-27 09:25 +0200
Re: Paper on dynamic memory allocation for real-time systems Sylvia Else <sylvia@not.at.this.address> - 2017-10-24 19:49 +1100
Re: Paper on dynamic memory allocation for real-time systems bitrex <bitrex@de.lete.earthlink.net> - 2017-10-24 19:20 -0400
csiph-web