[comp.windows.ms.programmer] Linked list in Global Heap?

stephenc@cunixf.cc.columbia.edu (Stephen Chung) (06/13/91)

Hi NetLanders,

I am writing an application that uses more than 64K of data memory.  Most
of the data is organized in numerous linked-lists, mainly smally nodes.
Any pointers on how to allocate the lists in the global heap?  If I
do a GlobalAlloc, won't that slow Windows down incredibly because of the
large number of memory blocks?  And I believe Windows has a limit on
the number of handles.  ALso, GlobalAlloc-ing the nodes will mean a
GLobalLock-GlobalUnlock pair for EVERY pointer access.  Slow.

Please reply to this account.  Thanks in advance for your help.

- Stephen

rhoda@mercury.sybase.com (Rhoda Neimand) (06/13/91)

----------------------------------------------------------------------
Rhoda Neimand			                  [I speak for myself]
{sun,lll-tis,pyramid,pacbell}!sybase!rhoda -or- rhoda@sybase.com
"I didn't want to, Jim"		  Mr. Spock in _This Side Of Paradise_
----------------------------------------------------------------------

rhoda@mercury.sybase.com (Rhoda Neimand) (06/13/91)

>In article (Stephen Chung) writes:
>I am writing an application that uses more than 64K of data memory.  Most
>of the data is organized in numerous linked-lists, mainly smally nodes.
>Any pointers on how to allocate the lists in the global heap?  If I
>do a GlobalAlloc, won't that slow Windows down incredibly because of the
>large number of memory blocks?  And I believe Windows has a limit on
>the number of handles.  ALso, GlobalAlloc-ing the nodes will mean a
>GLobalLock-GlobalUnlock pair for EVERY pointer access.  Slow.
>
>Please reply to this account.  Thanks in advance for your help.

I, and I'm sure others, would like to see responses on the net.  I'm going
to be doing lots of Local and Global Allocs and would like to hear people's
opinions and experiences regarding memory allocation.

P.S.  Sorry for the previous blank posting.

----------------------------------------------------------------------
Rhoda Neimand			                  [I speak for myself]
{sun,lll-tis,pyramid,pacbell}!sybase!rhoda -or- rhoda@sybase.com
"I didn't want to, Jim"		  Mr. Spock in _This Side Of Paradise_
----------------------------------------------------------------------

ryoung@pollux.svale.hp.com (Roderick Young) (06/19/91)

Kind of outdated, but in a windows 2 (TWO) game I wrote a while back,
I had to do about 3000 globalallocs in one function, plus overhead for
copying data and linking in the new records.  The records were about
80 bytes.  This operation took about 10 seconds on a 20 MHz 386.  If
you're only going to be doing a few dozen globalallocs a second, I
wouldn't worry about it.