home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!stanford.edu!ames!haven.umd.edu!wam.umd.edu!kovert
- From: kovert@wam.umd.edu (Todd Kover)
- Subject: Re: Program Fragmenting Memory
- Message-ID: <1992Aug13.202314.9393@wam.umd.edu>
- Sender: usenet@wam.umd.edu (USENET News system)
- Nntp-Posting-Host: rac2.wam.umd.edu
- Organization: Insufficient Memory Software
- References: <1992Aug9.023203.7467@ariel.ec.usf.edu>
- Date: Thu, 13 Aug 1992 20:23:14 GMT
- Lines: 37
-
- In article <1992Aug9.023203.7467@ariel.ec.usf.edu> stelmack@eggo.tmc.edu (Gregory M. Stelmack) writes:
- >My latest project has been fragmenting memory, and leaving two small chunks
- >behind. Running MungWall & MungList (thanks for Sushi!) reveals two tiny
- >chunks unfreed by my task -- sizes $0a and $a8. Anyway, I wrote my own
- >wrappers for AllocMem and FreeMem that track the size and location of my
- >allocations, and replaced all my calls with these wrappers (searching every
- >source file to make sure I got them all). When I run with these, I still
- >lose memory, but all my Allocs are properly matched by same-sized Frees
- >(and MungWall does not complain). Also, neither address for the fragments
- >matches any of my allocations.
- >
- >So, does anyone know of anything that might be causing this? I am using
- >SAS/C 5.10b, and will call SAS Monday to see if there might be something
- >with their startup/shutdown code, but in the meantime am asking here.
- >Any ideas? Anyone know of any other tools that might help me track this
- >down?
-
- I don't know what's causing it, but I ran into a similar problem when
- writing a shared library. (In my case, I took an include file in all of
- my source files, and #define'd AllocMem(x,y) AllocMemWrap(x,y) and
- FreeMem(x,y) FreeMemWrap(x,y) and #undef's them in front of the actual
- function definitions).
-
- I ran into the exact same problem. Once I implemented these wrappers
- (and changed nothing else) there was no more fragmentation. (Many many
- calls to all aspects of the library never yielded a problem, (naturally
- including the situations that originally did).
-
- I'm using 5.10a, though, so I thought it may have something to do with that.
- Perhaps not, though.
-
- -Todd
- --
- /* Todd Kover // [ #include <std/disclaimer.h> ] "Murphy's Law of Dating II:
- \X/ [ Internet: kovert@wam.umd.edu ] If you like her, she lives
- CIS: 70621,2376 [ Fido: 1:109/447 & 1:261/5016 ] in a different state."
- "Profanity is the language that all programmers know Best." */
-