Article View: comp.os.msdos.programmer
Article #7724Re: Help on Memory Manager
From: Walter Bright
Date: Sat, 23 Jan 1993 23:38
Date: Sat, 23 Jan 1993 23:38
20 lines
1704 bytes
1704 bytes
In article <1993Jan18.185050.4937@proto.com> joe@proto.com (Joe Huffman) writes: /bright@nazgul.UUCP (Walter Bright) writes: />In article <1993Jan12.083016.4726@jarvis.csri.toronto.edu> parki@csri.toronto.edu (Brian Parkinson) writes: />/(2) I need to have a 64K (EXACTLY) byte memory block in an />/application, and would like to be aligned from the base of />/the segment (i.e. an offset of 0 (zero) not 4 (four)), so />/if I just say "ptr-=4", the pointer will now be at the base />/of the segment, but..... is this inviting disaster ??? />Yes, you are inviting disaster doing this. /You can save the 4 bytes of data at the offset 'ptr - 4' then restore /it before you free it. IMHO this would result in a slight risk of /disaster, rather than 'inviting disaster'. Assuming, of course, that those 4 bytes do not form a link in some linked list used by the Borland library routines, and you don't have any intervening calls to such routines. If you want to be sure, you'll have to look at the Borland library source. Otherwise, call DOS directly to do your own memory allocation. In any case, if you use those 4 bytes you will be relying on undocumented behavior which should be avoided whenever a practical alternative exists.
Technical Details
Message-ID:
<1587@nazgul.UUCP>Path:
arc1-ca.pugleaf.net!sparky!uunet!pilchuck!fnx!nazgul!brightReferences:
<1993Jan12.083016.4726@jarvis.csri.toronto.edu> <1576@nazgul.UUCP> <1993Jan18.185050.4937@proto.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pilchuck!fnx!nazgul!bright From: bright@nazgul.UUCP (Walter Bright) Newsgroups: comp.os.msdos.programmer Subject: Re: Help on Memory Manager Message-ID: <1587@nazgul.UUCP> Date: 23 Jan 93 23:38:58 GMT References: <1993Jan12.083016.4726@jarvis.csri.toronto.edu> <1576@nazgul.UUCP> <1993Jan18.185050.4937@proto.com> Reply-To: bright@nazgul.UUCP (Walter Bright) Distribution: na Organization: Zortech, Seattle Lines: 20