/* $Id: f_malloc.h,v 1.14 2004/12/16 17:39:47 andrei Exp $ * * simple, very fast, malloc library * * Copyright (C) 2001-2003 FhG Fokus * * This file is part of ser, a free SIP server. * * ser is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version * * For a license to use the ser software under conditions * other than those described here, or to purchase support for this * software, please contact iptel.org by e-mail at the following addresses: * info@iptel.org * * ser is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * History: * -------- * 2003-05-21 on sparc64 roundto 8 even in debugging mode (so malloc'ed * long longs will be 64 bit aligned) (andrei) * 2004-07-19 support for 64 bit (2^64 mem. block) and more info * for the future de-fragmentation support (andrei) * 2004-11-10 support for > 4Gb mem., switched to long (andrei) */ #if !defined(f_malloc_h) && !defined(VQ_MALLOC) #define f_malloc_h /* defs*/ #ifdef DBG_F_MALLOC #if defined(__CPU_sparc64) || defined(__CPU_sparc) /* tricky, on sun in 32 bits mode long long must be 64 bits aligned * but long can be 32 bits aligned => malloc should return long long * aligned memory */ #define ROUNDTO sizeof(long long) #else #define ROUNDTO sizeof(void*) /* size we round to, must be = 2^n, and sizeof(fm_frag) must be multiple of ROUNDTO !*/ #endif #else /* DBG_F_MALLOC */ #define ROUNDTO 8UL #endif #define MIN_FRAG_SIZE ROUNDTO #define F_MALLOC_OPTIMIZE_FACTOR 14UL /*used below */ #define F_MALLOC_OPTIMIZE (1UL<