Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!microsoft!matts From: matts@microsoft.UUCP (Matt SAETTLER) Newsgroups: comp.windows.ms Subject: Re: DLL memory management and the heapsize Message-ID: <57838@microsoft.UUCP> Date: 1 Oct 90 00:14:36 GMT References: <4944@hsv3.UUCP> <388@nwnexus.WA.COM> <4990@hsv3.UUCP> Reply-To: matts@microsoft.UUCP (Matt SAETTLER) Distribution: usa Organization: Microsoft Corp., Redmond WA Lines: 43 In article <4990@hsv3.UUCP> jls@headland.UUCP (James Seidman) writes: >In article <388@nwnexus.WA.COM> roper@nwnexus.UUCP (Michael Roper) writes: >>HEAPSIZE is the initial size of the heap. The heap can never be smaller >>than HEAPSIZE, but it can be bigger. > >That's what I thought, but when I do a LocalAlloc() which would require >extended the heap, it always fails. I'm using the standard LIBENTRY.OBJ >which comes in the sample code for the SDK, and compiling using the small >model. > When Windows goes to grow your LoacalHeap (which is a GlobalHeap element) it must have space after it, or be able to move it to where there is space. If you have declared the Data segment FIXED (in your .DEF file), then it cannot be moved. This is most likely your problem. Petzold's book explains memory management in pretty good detail. >>> (And please don't tell me to use GlobalAlloc(), either... I'm >>> dereferencing pointers in tight loops and having them be far would cause >>> performance impairments.) > >>If you have C 6.0, based pointers will solve your "tight loop" problem >>when using global memory. > >I've looked into this, and you're right, this is a very good suggestion. >BTW, I have heard that loading segment registers in protected mode takes >a VERY long time (36 cycles sticks in my mind). Is this true, and if so >does that have the type of performance implications I think it does for >medium model programs which do a lot of calling between segments? It does take much more time due to the protection checks. From the Int*l 80386 Progammer's Reference Manual: Instruction Clocks Description mov Sreg,r/m16 2/5, pm=18/19 Move r/m word to segment register pop Sreg 7,pm=21 Pop top of stack into segment register For medium model, grouping your functions so that the 'helper' functions are in a segment (and can be declared NEAR) means only a segment load hit when you call the interface points in that module. ---------------------------------------------------- I speak only for myself, or so I'm told to say...