Article View: comp.os.os2.programmer.misc
Article #156Re: DosSubFreeMem(): Coalesces Contiguous Blocks?
From: Ken Brady
Date: Sun, 19 May 1996 00:00
Date: Sun, 19 May 1996 00:00
30 lines
1805 bytes
1805 bytes
> > In <4ndid4$d0m@cpcug.org>, kbennett@cpcug.org (Keith Bennett) writes: > >This message pertains to DosSubFreeMem() and related functions. > > > >When it frees a block, does it join together contiguous free areas of > >memory? > > > >We're getting a problem where we're running out of memory prematurely. > > > >In general, is the algorithm for allocating and freeing fairly > >intelligent? > > > As much as I've used it, the best way to use DosSub... function is to allocate > a big memory buffer (more than one meg) as uncommited memory, and let > DosSub... functions manage it. What ever you allocate will be commited as it > is needed. As far as I know, if you free a memory a block, the function won't > shrink any memory (it cannot change the address of the already allocated > blocks), but it will uncommit blocks of memory that are not in use > anymore (if you used DosSetMem with the option DOSSUB_SPARSE_OBJ). > Check out the May '96 issue of C/C++ User's Journal. There is a decent article on OS/2 memory, related API's, and causes of 'premature' memory depletion. There is a nifty (though unsophisticated) heap manager class described. Ken Brady kbrady@ultranet.com
Technical Details
Message-ID:
<4nm0cu$ng7@decius.ultra.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4nhukt$13t@hermes.is.co.za>,<4ndid4$d0m@cpcug.org>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11307a,6c0359dbabf01d83 X-Google-Attributes: gid11307a,public X-Google-Thread: 10cd94,6c0359dbabf01d83 X-Google-Attributes: gid10cd94,public From: Ken Brady <kbrady@ultranet.com> Subject: Re: DosSubFreeMem(): Coalesces Contiguous Blocks? Date: 1996/05/19 Message-ID: <4nm0cu$ng7@decius.ultra.net> X-Deja-AN: 155525447 references: <4nhukt$13t@hermes.is.co.za>,<4ndid4$d0m@cpcug.org> organization: UltraNet Communications, Inc. newsgroups: comp.os.os2.programmer.misc,bit.listserv.os2-l