Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Uno <merrilljensen@q.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Manage an unknown number of objects without malloc |
| Date | 2011-09-25 04:52 -0700 |
| Message-ID | <9e8feaFu6kU1@mid.individual.net> (permalink) |
| References | <j3a6gd$415$1@nnrp.ngi.it> <9f58c08f-d1a2-4d6b-ba86-3620e52aa9f2@o9g2000vbo.googlegroups.com> <0578e15c-8633-482f-832e-7d1b82e61abd@u6g2000vbo.googlegroups.com> |
On 9/25/2011 1:09 AM, Malcolm McLean wrote: > On Aug 30, 6:18 am, HENRY Eshbaugh<henryeshba...@gmail.com> wrote: >> >> Write your own malloc(). Read the kmalloc() implementation in the >> Linux kernel, plus the stuff on caching. >> > If there's no malloc(), there's usually a good reason for that, which > is that resources are so constrained that the tiny memory pool will > fragment and the function start returning nulls in no time. If there's no malloc(), get your money back. 2 gigs is disposable now. > > However you can implement a stack allocator. Simply pop and push > regions on the stack. This means that all memory you allocate has to > be freed in strict reverse order, and only the stack top can be > reallocated. Most small programs can be written to obey these rules. > (The exception is when you need a tree or graph like structure). All structures are graph-like. Some are trivial. -- Uno
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Manage an unknown number of objects without malloc Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-25 01:09 -0700
Re: Manage an unknown number of objects without malloc Uno <merrilljensen@q.com> - 2011-09-25 04:52 -0700
Re: Manage an unknown number of objects without malloc Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-25 04:57 -0700
Re: Manage an unknown number of objects without malloc Uno <merrilljensen@q.com> - 2011-09-26 22:06 -0700
Re: Manage an unknown number of objects without malloc Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-27 01:09 -0700
Re: Manage an unknown number of objects without malloc Uno <merrilljensen@q.com> - 2011-09-27 04:17 -0700
Re: Manage an unknown number of objects without malloc Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-27 11:54 +0100
Re: Manage an unknown number of objects without malloc Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-27 04:43 -0700
csiph-web