Gnash  0.8.10
jemalloc.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; c-basic-offset: 8 -*- */
00002 /* vim:set softtabstop=8 shiftwidth=8: */
00003 /*-
00004  * Copyright (C) 2006-2008 Jason Evans <jasone@FreeBSD.org>.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice(s), this list of conditions and the following disclaimer as
00012  *    the first lines of this file unmodified other than the possible
00013  *    addition of one or more copyright notices.
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice(s), this list of conditions and the following disclaimer in
00016  *    the documentation and/or other materials provided with the
00017  *    distribution.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
00020  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00022  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
00023  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
00026  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00027  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00028  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00029  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 #ifndef _JEMALLOC_H_
00033 #define _JEMALLOC_H_
00034 
00035 #include "jemalloc_types.h"
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 extern const char *_malloc_options;
00042 
00043 /* Darwin and Linux already have memory allocation functions */
00044 #if (!defined(MOZ_MEMORY_DARWIN) && !defined(MOZ_MEMORY_LINUX))
00045 void    *malloc(size_t size);
00046 void    *valloc(size_t size);
00047 void    *calloc(size_t num, size_t size);
00048 void    *realloc(void *ptr, size_t size);
00049 void    free(void *ptr);
00050 int     posix_memalign(void **memptr, size_t alignment, size_t size);
00051 #endif /* MOZ_MEMORY_DARWIN, MOZ_MEMORY_LINUX */
00052 
00053 #if defined(MOZ_MEMORY_ANDROID) || defined(WRAP_MALLOC)
00054 void    *je_malloc(size_t size);
00055 void    *je_valloc(size_t size);
00056 void    *je_calloc(size_t num, size_t size);
00057 void    *je_realloc(void *ptr, size_t size);
00058 void    je_free(void *ptr);
00059 int     je_posix_memalign(void **memptr, size_t alignment, size_t size);
00060 char    *je_strndup(const char *src, size_t len);
00061 char    *je_strdup(const char *src);
00062 #endif
00063 
00064 /* Linux has memalign and malloc_usable_size */
00065 #if !defined(MOZ_MEMORY_LINUX)
00066 void    *memalign(size_t alignment, size_t size);
00067 size_t  malloc_usable_size(const void *ptr);
00068 #endif /* MOZ_MEMORY_LINUX */
00069 
00070 void    jemalloc_stats(jemalloc_stats_t *stats);
00071 
00072 #ifdef __cplusplus
00073 } /* extern "C" */
00074 #endif
00075 
00076 #endif /* _JEMALLOC_H_ */