Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #25460

Re: g++ on Cortex-M with no dynamic memory

From Don Y <blockedofcourse@foo.invalid>
Newsgroups comp.arch.embedded
Subject Re: g++ on Cortex-M with no dynamic memory
Date 2016-11-08 08:01 -0700
Organization A noiseless patient Spider
Message-ID <nvspc2$2ft$1@dont-email.me> (permalink)
References (6 earlier) <nvqqrd$hhf$1@dont-email.me> <kc132clolt74fqmms83orohe68t68j5s77@4ax.com> <nvs610$vep$1@dont-email.me> <rie32ctjgqqako7kj3mrpv1rrb5v4i6a6p@4ax.com> <nvsisc$ari$1@dont-email.me>

Show all headers | View raw


Hi Dimiter,

On 11/8/2016 6:11 AM, Dimiter_Popoff wrote:
>>>> The problem with heaps is the fragmentation of the heap in a long
>>>> running system. It might seem running OK for the first year, but will
>>>> it run for the next ten years ?
>>>
>>> That depends on how that memory is physically implemented.
>>> E.g., slip a VMM under it and issues change (albeit at the
>>> granularity of pages)
>>
>> If you have some virtual memory system available that helps a lot
>>
>> Unfortunately a virtual memory system requires a backup storage to
>> hold the "dirty" pages, a page file.
>>
>> If rotating fans and rotating disk can't be used, the only alternative
>> is a Flash disk with limited number of write cycles.
>
> While generally so VM does not necessarily need to swap memory.
> If your physical memory is say 64M and your logical space is set to
> say 1G _and_ you know the 64M will never be all used up, the benefit
> of the VM is that fragmentation will be much less of a problem.

It also lets you "write protect" memory, trap on writes to
memory that shouldn't be written, trap on writes to memory
that *should* be written, provide protected address spaces,
share memory with different processes (and in different places),
move large blocks of memory in constant time, etc.

Put the stack "someplace special" (in that large, "empty" address
space) and let the hardware tell you when you need to allocate
another page for the stack -- or, when you've *underrun* it, etc.

[Things that are hard to do with pure software mechanisms]

> Then if memory is allocated using worst-fit strategy fragmentation
> is not much of an issue even without VM.
>
> To me (writing under DPS) stack usage and general allocation
> are just both in use, stacks are nice because of what you already
> stated, generic allocation (not sure how you'd call that, when
> you do a system call to allocate that much memory and you get
> returned the address and the actually allocated size (the latter
> probably somewhat more than requested because of the granularity))
> is good because it can be deallocated "out of order" (unlike stack
> frames).

The problem with most memory allocators is they are used for a
hodge-podge of unstructured/unordered requests.  E.g., override
new() and you'll have a better chance at a "well behaved" memory
subsystem.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

g++ on Cortex-M with no dynamic memory Dave Nadler <drn@nadler.com> - 2016-11-05 14:09 -0700
  Re: g++ on Cortex-M with no dynamic memory antispam@math.uni.wroc.pl - 2016-11-07 02:55 +0000
    Re: g++ on Cortex-M with no dynamic memory Tom Gardner <spamjunk@blueyonder.co.uk> - 2016-11-07 07:52 +0000
      Re: g++ on Cortex-M with no dynamic memory Wouter van Ooijen <wouter@voti.nl> - 2016-11-07 09:11 +0100
        Re: g++ on Cortex-M with no dynamic memory Tim Wescott <tim@seemywebsite.com> - 2016-11-07 10:08 -0600
      Re: g++ on Cortex-M with no dynamic memory David Brown <david.brown@hesbynett.no> - 2016-11-07 10:02 +0100
      Re: g++ on Cortex-M with no dynamic memory Dave Nadler <drn@nadler.com> - 2016-11-08 12:01 -0800
    Re: g++ on Cortex-M with no dynamic memory Dave Nadler <drn@nadler.com> - 2016-11-07 04:13 -0800
      Re: g++ on Cortex-M with no dynamic memory Tim Wescott <tim@seemywebsite.com> - 2016-11-07 10:15 -0600
        Re: g++ on Cortex-M with no dynamic memory Wouter van Ooijen <wouter@voti.nl> - 2016-11-07 18:39 +0100
          Re: g++ on Cortex-M with no dynamic memory Tim Wescott <seemywebsite@myfooter.really> - 2016-11-07 11:59 -0600
            Re: g++ on Cortex-M with no dynamic memory Wouter van Ooijen <wouter@voti.nl> - 2016-11-07 19:40 +0100
            Re: g++ on Cortex-M with no dynamic memory Dave Nadler <drn@nadler.com> - 2016-11-08 11:59 -0800
              Re: g++ on Cortex-M with no dynamic memory Wouter van Ooijen <wouter@voti.nl> - 2016-11-08 23:30 +0100
                Re: g++ on Cortex-M with no dynamic memory David Brown <david.brown@hesbynett.no> - 2016-11-09 09:23 +0100
                Re: g++ on Cortex-M with no dynamic memory Wouter van Ooijen <wouter@voti.nl> - 2016-11-10 07:34 +0100
                Re: g++ on Cortex-M with no dynamic memory David Brown <david.brown@hesbynett.no> - 2016-11-10 10:43 +0100
                Re: g++ on Cortex-M with no dynamic memory Dave Nadler <drn@nadler.com> - 2016-11-11 16:53 -0800
                Re: g++ on Cortex-M with no dynamic memory David Brown <david.brown@hesbynett.no> - 2016-11-12 14:21 +0100
                Re: g++ on Cortex-M with no dynamic memory Jack <jack4747@gmail.com> - 2016-11-21 04:08 -0800
          Re: g++ on Cortex-M with no dynamic memory upsidedown@downunder.com - 2016-11-07 23:01 +0200
            Re: g++ on Cortex-M with no dynamic memory Don Y <blockedofcourse@foo.invalid> - 2016-11-07 14:14 -0700
              Re: g++ on Cortex-M with no dynamic memory upsidedown@downunder.com - 2016-11-08 10:57 +0200
                Re: g++ on Cortex-M with no dynamic memory Don Y <blockedofcourse@foo.invalid> - 2016-11-08 02:31 -0700
                Re: g++ on Cortex-M with no dynamic memory upsidedown@downunder.com - 2016-11-08 13:52 +0200
                Re: g++ on Cortex-M with no dynamic memory Dimiter_Popoff <dp@tgi-sci.com> - 2016-11-08 15:11 +0200
                Re: g++ on Cortex-M with no dynamic memory Don Y <blockedofcourse@foo.invalid> - 2016-11-08 08:01 -0700
                Re: g++ on Cortex-M with no dynamic memory Dimiter_Popoff <dp@tgi-sci.com> - 2016-11-09 08:26 +0200
                Re: g++ on Cortex-M with no dynamic memory Don Y <blockedofcourse@foo.invalid> - 2016-11-09 00:55 -0700
                Re: g++ on Cortex-M with no dynamic memory Dimiter_Popoff <dp@tgi-sci.com> - 2016-11-10 10:27 +0200
                Re: g++ on Cortex-M with no dynamic memory Don Y <blockedofcourse@foo.invalid> - 2016-11-10 02:40 -0700
                Re: g++ on Cortex-M with no dynamic memory Don Y <blockedofcourse@foo.invalid> - 2016-11-08 06:58 -0700
            Re: g++ on Cortex-M with no dynamic memory Wouter van Ooijen <wouter@voti.nl> - 2016-11-07 23:01 +0100
              Re: g++ on Cortex-M with no dynamic memory Dave Nadler <drn@nadler.com> - 2016-11-08 11:38 -0800
        Re: g++ on Cortex-M with no dynamic memory Tim Wescott <tim@seemywebsite.com> - 2016-11-07 20:02 -0600
    Re: g++ on Cortex-M with no dynamic memory upsidedown@downunder.com - 2016-11-07 22:56 +0200
      Re: g++ on Cortex-M with no dynamic memory Don Y <blockedofcourse@foo.invalid> - 2016-11-07 14:11 -0700
        Re: g++ on Cortex-M with no dynamic memory David Brown <david.brown@hesbynett.no> - 2016-11-08 10:37 +0100
          Re: g++ on Cortex-M with no dynamic memory upsidedown@downunder.com - 2016-11-08 13:38 +0200
            Re: g++ on Cortex-M with no dynamic memory David Brown <david.brown@hesbynett.no> - 2016-11-08 13:32 +0100
            Re: g++ on Cortex-M with no dynamic memory Don Y <blockedofcourse@foo.invalid> - 2016-11-08 07:09 -0700
  Re: g++ on Cortex-M with no dynamic memory Wouter van Ooijen <wouter@voti.nl> - 2016-11-07 08:10 +0100

csiph-web