Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / tools / jprof / stub / libmalloc.h
blob80e7b57cca0aa7663e8d82e42f1c1f58f6373d0c
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is mozilla.org code.
16 * The Initial Developer of the Original Code is Kipp E.B. Hickman.
17 * Portions created by the Initial Developer are Copyright (C) 1998
18 * the Initial Developer. All Rights Reserved.
20 * Contributor(s):
22 * Alternatively, the contents of this file may be used under the terms of
23 * either the GNU General Public License Version 2 or later (the "GPL"), or
24 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
25 * in which case the provisions of the GPL or the LGPL are applicable instead
26 * of those above. If you wish to allow use of your version of this file only
27 * under the terms of either the GPL or the LGPL, and not to allow others to
28 * use your version of this file under the terms of the MPL, indicate your
29 * decision by deleting the provisions above and replace them with the notice
30 * and other provisions required by the GPL or the LGPL. If you do not delete
31 * the provisions above, a recipient may use your version of this file under
32 * the terms of any one of the MPL, the GPL or the LGPL.
34 * ***** END LICENSE BLOCK ***** */
36 #ifndef libmalloc_h___
37 #define libmalloc_h___
39 #include <sys/types.h>
40 #include <malloc.h>
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 #include "config.h"
48 typedef unsigned long u_long;
50 // Format of a malloc log entry. This is what's written out to the
51 // "malloc-log" file.
52 struct malloc_log_entry {
53 u_long delTime;
54 u_long numpcs;
55 char* pcs[MAX_STACK_CRAWL];
58 // type's
59 #define malloc_log_stack 7
61 // Format of a malloc map entry; after this struct is nameLen+1 bytes of
62 // name data.
63 struct malloc_map_entry {
64 u_long nameLen;
65 u_long address; // base address
68 // A method that can be called if you want to programmatically control
69 // the malloc logging. Note that you must link with the library to do
70 // this (or use dlsym after dynamically loading the library...)
71 extern u_long SetMallocFlags(u_long flags);
73 // The environment variable LIBMALLOC_LOG should be set to an integer
74 // value whose meaning is as follows:
76 // Enable logging
77 #define LIBMALLOC_LOG 0x1
79 // Don't free memory when set
80 #define LIBMALLOC_NOFREE 0x2
82 // Check heap for corruption after every malloc/free/realloc
83 #define LIBMALLOC_CHECK 0x4
85 // Log reference count calls (addref/release)
86 #define LIBMALLOC_LOG_RC 0x8
88 // Log a stack trace
89 #define LIBMALLOC_LOG_TRACE 0x10
91 void __log_addref(void* p, int oldrc, int newrc);
92 void __log_release(void* p, int oldrc, int newrc);
94 #ifdef __cplusplus
95 } /* end of extern "C" */
96 #endif
98 #endif /* libmalloc_h___ */