Newsgroups: comp.windows.ms.programmer
Path: utzoo!utgpu!watserv1!sunee!gpsteffl
From: gpsteffl@sunee.waterloo.edu (Glenn Steffler)
Subject: Re: How to best represent a list in Windows?
Message-ID: <1991Apr16.065308.5749@sunee.waterloo.edu>
Organization: Gold Disk Inc.
References: <1991Apr5.205519.29757@sunee.waterloo.edu> <3714@polari.UUCP> <24183@well.sf.ca.us>
Date: Tue, 16 Apr 1991 06:53:08 GMT
Lines: 31

Tony G sez, and I quoteth:

>Another way you can do this is to create a local heap in a separate
>block of memory allocated by GlobalAlloc.  LocalInit will create
>a local heap in that block for you.

Good idea for small (and boy do I mean small) linked list.  But I am 
dealing with something over 150k of list memory for a long
(say five minute) movie!  There is no easy way of determining which
list element belongs to which global block unless you allocate the 
memory such that it doesn't matter, and treat the 32 pointers just
like you would in Unix et all.

I also wrote a small memory management function set which doesn't
allocate global blocks and split the memory, but allocates a 
SINGLE GLOBAL block for every list item!  This is a great way to
debug code, because it makes sure that any warry accesses to the 
memory will be trapped in protect mode.  I also made sure the pointer
was aligned in the global block such that no matter how many "extra"
bytes windows afforded me on the global alloc call (found via GlobalSize)
I always return a pointer whose end position (from length given in
my_malloc call) will produce a GP fault if even ONE byte more is read
or written to the block!  Saved my butt couple o' times... :-)

Anyway, just my little ol' ramblings.

-- 
Windows Sumo Wrestler                "Bo doesn't know software" - George Brett
  --(Windows 3.0, a combination of modern moodring technology and voodoo)--
"I guess she had a way, of making every night seem bright as day"
`I Don't Believe In Love`   -Queensryche (Oper. Mindcrime)     Glenn Steffler
