Пример #1
0
/*
 * ========================
 * Memory_Init
 * ========================
 */
void
Memory_Init(void *buf, int size)
{
    int p;
    int zonesize = DYNAMIC_SIZE;

    hunk_base = (byte*)buf;
    hunk_size = size;
    hunk_low_used = 0;
    hunk_high_used = 0;

    Cache_Init();
    p = COM_CheckParm("-zone");
    if (p) {
	if (p < com_argc - 1)
	    zonesize = Q_atoi(com_argv[p + 1]) * 1024;
	else
	    Sys_Error("%s: you must specify a size in KB after -zone",
		      __func__);
    }
    mainzone = (memzone_t*)Hunk_AllocName(zonesize, "zone");
    Z_ClearZone(mainzone, zonesize);

    /* Needs to be added after the zone init... */
    Cmd_AddCommand("flush", Cache_Flush);
    Cmd_AddCommand("hunk", Hunk_f);
    Cmd_AddCommand("cache", Cache_f);
}
Пример #2
0
/*
========================
Memory_Init
========================
*/
void Memory_Init (void *buf, int size)
{
	int p;
	int zonesize = DYNAMIC_SIZE;

	hunk_base = (byte *)buf;
	hunk_size = size;
	hunk_low_used = 0;
	hunk_high_used = 0;
	
	Cache_Init ();
	p = COM_CheckParm ("-zone");
	if (p)
	{
		if (p < com_argc-1)
			zonesize = Q_atoi (com_argv[p+1]) * 1024;
		else
			Sys_Error ("Memory_Init: you must specify a size in KB after -zone");
	}
	mainzone = (memzone_t *)Hunk_AllocName (zonesize, "zone" );
	Z_ClearZone (mainzone, zonesize);
}