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

Re: [MiNT] MiNT problem



Hi!

On Fri, Aug 27, 1999 at 01:07:32PM +0100, Jo-Even.Skarstein@gjensidige.no wrote:
> Btw. does anybody have the source to 'free'? I was thinking of making a
> simple GEM-version with a fragmentation-map.

I don't have it, but it basically works like this

sum = cnt = max = 0L;
while (size = Malloc(-1L) > 0)
{
	if ((long)Malloc(size) < 0)
	{
		/* "Fatal" error */
		break;
	}
	cnt++;
	sum += size;
	if (size > max)
		max = size;
}
/* Print statistics from sum, cnt, and max */

This is not very multitasking-friendly, as it temporarily hogs all
available memory (provided MAXMEM is unset), but AFAIK there's no GEMDOS
call to get information like this.


Ciao

Thomas


-- 
Thomas Binder (Gryf @ IRCNet)  gryf@hrzpub.tu-darmstadt.de
PGP-key available on request!  binder@rbg.informatik.tu-darmstadt.de
Vote against SPAM:             http://www.politik-digital.de/spam/

Attachment: pgpXqKD7eBXm1.pgp
Description: PGP signature