[comp.os.vms] C memory management problems on VMS 4.6

x_haraldsen@INGER.ARPA ("TORE HARALDSEN") (01/28/88)

My old C utilities are failing after we installed VMS 4.6.
I have traced the problems down to a sequence of
malloc ... realloc ... free
where the return value from malloc is stored in the address part of
a standard VMS descriptor. The following realloc fails, and if realloc
is removed, the free fails anyway.

The code goes somewhat like this:

	fdl$desc->dsc$a_pointer = malloc (4096);
	...
	fdl$desc->dsc$a_pointer = realloc (fdl$desc->dsc$a_pointer, newsz);
	...
	free (fdl$desc->dsc$a_pointer);

(writing from natures memory, my C is not that strong...)
I have tried recompiling and reloading (i loaded with re-entrant
VAXCRTL since disk space is scarce on my little machine), but to
no avail. Anybody know what's wrong and how to get around it??

	Tore Haraldsen
	University of Oslo
	Box 1059 Blindern
	N - 0316 Oslo 3
	Norway

	x_haraldsen@inger.uio.no
------

-------