home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.os.ms-windows.programmer.misc:3410 comp.os.ms-windows.programmer.tools:1413
- Newsgroups: comp.os.ms-windows.programmer.misc,comp.windows.ms.programmer,comp.os.ms-windows.programmer.tools
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!cs.ubc.ca!uw-beaver!fluke!moriarty
- From: moriarty@tc.fluke.COM (Jeff Meyer)
- Subject: Re: generic replacement for malloc and free using Global...?
- Message-ID: <1992Nov13.182636.5749@tc.fluke.COM>
- Followup-To: comp.os.ms-windows.programmer.misc
- Summary: MS, w/ C7 and Win 3.1, recommends going back to using malloc
- Keywords: malloc free GlobalAlloc GlobalFree
- Reply-To: moriarty@tc.fluke.COM (Jeff Meyer)
- Organization: The John Fluke Mfg. Co. /a.k.a. The Gizmonics Institute/
- Date: Fri, 13 Nov 1992 18:26:36 GMT
- Lines: 40
-
- In comp.windows.ms.tools whedon@netcom.com writes:
-
- >I wonder if anyone has a generic replacement for malloc and free which make
- >use of GlobalAlloc and GlobalFree? I did those up, but for some reason, the
- >memory thus allocated doesn't seem to be getting released properly, even
- >though I am careful to execute one free for each malloc. As an offshoot of
- >this, my memory slowly goes down in Windows until I terminate my app, at
- >which time it all appears to come back. Any ideas? Working procs? Please
- >email me and I will summarize, as I know of at least two other people who
- >want this stuff. I suspect there're more...
-
- There's a Microsoft C/C++ Technical Note ("Allocating Memory the
- Old-Fashioned Way: _fmalloc and Applications for Windows" by Dale Rogerson,
- dated July of this year) that basically says that with the combination of MS
- C/C++ 7.0 being released and the advent of Windows 3.1 (where there is no
- real mode) -- and, I suspect, the coming of Win32 and NT -- MS is going back
- to recommending that you use malloc and free instead of the
- LocalAlloc/GlobalAlloc calls.
-
- In particular, the article mentions using _fmalloc (under C7, calls to
- malloc in large memory models are automatically mapped to _fmalloc) as
- opposed to GlobalAlloc because it is more efficient in the use of memory;
- fmalloc basically calls GlobalAlloc with the GMEM_MOVEABLE option, but
- doesn't allocate a new global segment for each call for memory.
- Using _ffree, however, appears to be a bit more complex than using
- GlobalFree; see the article for more information.
-
- Don't know if this is of help, but I thought I should draw your attention to
- this article. (After using Global/LocalAlloc for months, it sort of took me
- by surprise that MS was suggesting going back to malloc!)
-
- "Open Channel D..."
- ---
- Moriarty, aka Jeff Meyer
- INTERNET: moriarty@tc.fluke.COM
- Manual UUCP: {uunet, uw-beaver, sun, microsoft}!fluke!moriarty
- CREDO: You gotta be Cruel to be Kind...
- **>> Keep circulating the tapes <<**
-
-
-