* Crossposted from: (Fido) International C Programming Conference
I was attempting to allocate some memory today using another person's
system (running TC++ 3.0) using the following code:
#include
#include
#include
int main (void)
{
char *x;
printf ("Free mem=%ld\n", coreleft();
/* In small memory model, this gives ~63.4k
In large memory model, result is random (-4382 one time,
4832382593 the next...) */
x = (char *)malloc (20);
if (!x)
{
printf ("Out of memory.");
return 1;
}
/* In small memory model, x=ds:7436 (OK, this value changes)
In large memory model, x=0000:0004 EVERY SINGLE TIME. */
free (x);
return 0;
}
Any idea what could be causing a pointer to 0000:0004 to be returned
on every single malloc()?
Take care,
Anthony Tibbs
... Blue Wave - World Tour - 1998
--- Blue Wave/DOS v2.30 [NR]
---------------
* Origin: The Tibbs' Point - Ottawa, ON, Canada - Pvt (1:163/215.38)
|