pspsdk-1.0+beta2
Main Page
Modules
Data Structures
Files
File List
Globals
malloc.h
Go to the documentation of this file.
1
/*
2
* PSP Software Development Kit - http://www.pspdev.org
3
* -----------------------------------------------------------------------
4
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5
*
6
* malloc.h
7
*
8
* Copyright (c) 2002-2004 PS2DEV
9
* Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
10
* Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
11
* Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
12
*
13
* $Id: malloc.h 1095 2005-09-27 21:02:16Z jim $
14
*/
15
16
#ifndef _MALLOC_H
17
#define _MALLOC_H
18
19
#include <
pspkernel.h
>
20
#include <stddef.h>
21
#include <stdarg.h>
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
27
/* stdlib/malloc */
28
void
*
malloc
(
size_t
size
);
29
void
*
realloc
(
void
*ptr,
size_t
size
);
30
void
*
calloc
(
size_t
n,
size_t
size
);
31
void
*
memalign
(
size_t
align,
size_t
size
);
32
void
free
(
void
* ptr);
33
34
/* Memory walkers. Used for debugging/profiling purposes. */
35
void
*
__mem_walk_begin
(
void
);
36
void
__mem_walk_read
(
void
* token,
u32
*
size
,
void
** ptr,
int
* valid);
37
void
*
__mem_walk_inc
(
void
* token);
38
int
__mem_walk_end
(
void
* token);
39
40
/* Example of use:
41
42
void * i;
43
44
for (i = __mem_walk_begin(); !__mem_walk_end(i); i = __mem_walk_inc(i)) {
45
u32 block_size;
46
void * block_ptr;
47
int valid;
48
49
__mem_walk_read(i, &block_size, &block_ptr, &valid);
50
if (!valid) {
51
fprintf(stderr, "Block at token %p is invalid.\n", i);
52
break;
53
}
54
printf("Block at token %p points at a memory block of %i bytes at %p.\n", i, block_size, block_ptr);
55
}
56
57
note that 'valid' will be always true if DEBUG_ALLOC was not defined when alloc.c got compiled.
58
59
*/
60
61
#ifdef __cplusplus
62
}
63
#endif
64
65
#endif // _MALLOC_H
66
src
libc
malloc.h
Generated on Sat Apr 9 2016 07:00:25 for pspsdk-1.0+beta2 by
1.8.1.2