[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting use of modern memory manager?



>Is there any programatic way of detecting whether the modern memory manager
>is turned on?  Although our programmers know to turn it off for MCL some of
>our saved applications find their way to other users who don't know of
>this.  I checked gestalt and didn't see anything obvious.
>-Thanks, David

There is an ugly and undocumented (so far as I know) way, which I worked
out using MacsBug (which gives a "hint" by renaming the field in the Zone
header in which the flag is found).  Here it is in C, taken from the source
code for a Frontier UCMD (code resource) which has reliably reported
whether or not MMM is on on both my 8100 (sometimes yes, sometimes no,
always right) and IIci (always no):


    THz myZone;
    Boolean isModern;

    myZone = GetZone ();

    // Here be dragons
    // If MacsBug macros are to be believed, first byte of maxNRel has become
    // heap type.
    // By observation, flag is 3 if modern memory manager is on, 1 if it is off
    isModern = 0 != ((*myZone).maxNRel & 0x0200);


[GetZone () is known to be sensible in the environement in which this code
can be called.]
--John

--
jwbaxter@pt.olympus.net (John W. Baxter)  Port Ludlow, WA