Article View: comp.os.ms-windows.programmer.tools
Article #688Re: How to implement a Linked List
From: Tom W. Brown
Date: Thu, 17 Dec 1992 17:18
Date: Thu, 17 Dec 1992 17:18
30 lines
2135 bytes
2135 bytes
In article <1992Dec17.084558.9832@nuscc.nus.sg>, shah@cherry.NoSubdomain.NoDomain (Shahrin Abdullah) writes: |> In article <724532588snz@chrism.demon.co.uk>, chris@chrism.demon.co.uk (Chris Marriott) writes: |> |> |> |> If you're using Microsoft C7, you can implement a linked list in Windows |> |> in exactly the same way you would for DOS - just use the standard run time |> |> library "malloc" function. If you use the large memory model (and there's |> |> no reason not to, any more), "malloc" gets mapped onto calls to a pretty |> |> good "sub-allocator". |> |> |> |> The problem here is that malloc will map the memory allocation to the local |> heap. Thus if the node dynamically grow too large the local heap won't be |> able to handle that. So the question remain - how do U implement a linear |> linked list using the Global Heap? Thanks Chris. |> I can't adequately speak for Microsoft C7, but I know Borland 3.1 uses a sub-segment allocator with globally allocated memory if you compile in large model. I'd be very suprised if C7 did any different. Note that Chris specified large model in his reply -- this is definitely the key. However, if I'm wrong and C7 still uses the local heap for large model memory allocation then perhaps you should switch compilers :-) ---------------------------------------------------------------------------- Tom Brown | "She turned me into a newt... PE Nelson Systems | ... I got better" twbrown@pe-nelson.com | Monty Python and the Holy Grail ----------------------------------------------------------------------------
Technical Details
Message-ID:
<720@lax.lax.pe-nelson.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrownReferences:
<1992Dec16.062628.3410@nuscc.nus.sg> <724532588snz@chrism.demon.co.uk> <1992Dec17.084558.9832@nuscc.nus.sg>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!lax.pe-nelson.com!lax!twbrown From: twbrown@PE-Nelson.COM (Tom W. Brown) Newsgroups: comp.os.ms-windows.programmer.tools Subject: Re: How to implement a Linked List Message-ID: <720@lax.lax.pe-nelson.com> Date: 17 Dec 92 17:18:44 GMT References: <1992Dec16.062628.3410@nuscc.nus.sg> <724532588snz@chrism.demon.co.uk> <1992Dec17.084558.9832@nuscc.nus.sg> Sender: news@lax.pe-nelson.com Organization: PE-Nelson Lines: 30