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


Groups > comp.sys.acorn.programmer > #1045

Re: Mixing Toolbox Menu objects with Wimp sub menus

Date 2011-11-18 08:01 +0000
From Matthew Phillips <spam2011m@yahoo.co.uk>
Newsgroups comp.sys.acorn.programmer
Subject Re: Mixing Toolbox Menu objects with Wimp sub menus
Message-ID <f200f83352.Matthew@sinenomine.freeserve.co.uk> (permalink)
References <3870129f-889e-4871-9647-1a9d61625548@x26g2000prf.googlegroups.com> <42e516bc-8a63-428e-9860-1b1df495ddcf@q16g2000yqn.googlegroups.com> <f4c74363-ad15-47a2-98b0-bdb70e70e9b3@p16g2000yqd.googlegroups.com> <6d62b9e3-d7a6-4ab9-a61c-e66773434220@o9g2000vbc.googlegroups.com> <7bb6072e-0080-4f2f-a1c6-ac518809359a@k10g2000yqn.googlegroups.com>

Show all headers | View raw


In message <7bb6072e-0080-4f2f-a1c6-ac518809359a@k10g2000yqn.googlegroups.com>
 on 17 Nov 2011 wpb  wrote:

> 2) My understanding of how malloc allocates memory for a Wimp task
> is...well, pretty much non-existent. Presumably it takes a chunk of my Wimp
> slot.

Yes, it takes a chunk of your Wimp slot and extends the Wimp slot if
necessary.  The extra Wimp slot is never relinquished again until the program
terminates.

> Would it be sensible to do a single large malloc for all the menu entries
> and menu text strings first, to avoid fragmentation? Or is that being
> overly paranoid?

It depends whether your routines for allocating that memory will end up being
better than the C Library's!  If you don't know much about it it's probably
best to let malloc do all the hard work.

Frangmentation only occurs if you free the memory.  If you can predict how
much memory you need well enough that you never need to free and reallocate
that large block you're proposing, then you could equally well allocate
adequate small lumps of memory, per menu entry and per text string.

If you can't predict that well, and you might have to free and reallocate,
then freeing and reallocating a big block of memory is going to cause
fragmentation on a larger scale, not reduce it.

-- 
Matthew Phillips
Durham

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Mixing Toolbox Menu objects with Wimp sub menus wpb <w.blatchley@yahoo.com> - 2011-11-15 13:16 -0800
  Re: Mixing Toolbox Menu objects with Wimp sub menus Martin Wuerthner <spamtrap@mw-software.com> - 2011-11-15 23:29 +0100
    Re: Mixing Toolbox Menu objects with Wimp sub menus wpb <w.blatchley@yahoo.com> - 2011-11-15 22:26 -0800
    Re: Mixing Toolbox Menu objects with Wimp sub menus Rik Griffin <nospam@denbridgemarine.com> - 2011-11-16 10:10 +0000
      Re: Mixing Toolbox Menu objects with Wimp sub menus Rik Griffin <nospam@denbridgemarine.com> - 2011-11-16 10:12 +0000
        Re: Mixing Toolbox Menu objects with Wimp sub menus wpb <w.blatchley@yahoo.com> - 2011-11-16 02:28 -0800
          Re: Mixing Toolbox Menu objects with Wimp sub menus Rik Griffin <nospam@denbridgemarine.com> - 2011-11-16 10:57 +0000
            Re: Mixing Toolbox Menu objects with Wimp sub menus wpb <w.blatchley@yahoo.com> - 2011-11-16 03:35 -0800
      Re: Mixing Toolbox Menu objects with Wimp sub menus wpb <w.blatchley@yahoo.com> - 2011-11-16 10:52 -0800
  Re: Mixing Toolbox Menu objects with Wimp sub menus Erik G <erikg@noname.invalid> - 2011-11-16 15:28 +0100
  Re: Mixing Toolbox Menu objects with Wimp sub menus Gerph <gerph@gerph.org> - 2011-11-17 01:54 -0800
    Re: Mixing Toolbox Menu objects with Wimp sub menus wpb <w.blatchley@yahoo.com> - 2011-11-17 06:40 -0800
      Re: Mixing Toolbox Menu objects with Wimp sub menus Gerph <gerph@gerph.org> - 2011-11-17 06:57 -0800
        Re: Mixing Toolbox Menu objects with Wimp sub menus wpb <w.blatchley@yahoo.com> - 2011-11-17 14:36 -0800
          Re: Mixing Toolbox Menu objects with Wimp sub menus Matthew Phillips <spam2011m@yahoo.co.uk> - 2011-11-18 08:01 +0000

csiph-web