Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kDebugAlloc.h
Go to the documentation of this file.
1
10 #ifndef K_API_DEBUG_ALLOC_H
11 #define K_API_DEBUG_ALLOC_H
12
13 #include <kApi/kApiDef.h>
14
15 kBeginHeader()
16
17
23 typedef struct kDebugAllocation
24 {
25 kByte* data;
26 kSize size;
27 k64u index;
28 kArrayList trace;
29 } kDebugAllocation;
30
37 //typedef kAlloc kDebugAlloc; --forward-declared in kApiDef.x.h
38
48 kFx(kStatus) kDebugAlloc_Construct(kDebugAlloc* object, const kChar* name, kAlloc allocator);
49
57 kFx(kStatus) kDebugAlloc_Clear(kDebugAlloc object);
58
66 kFx(kSize) kDebugAlloc_Allocated(kDebugAlloc object);
67
76 kFx(k64u) kDebugAlloc_Checkpoint(kDebugAlloc object);
77
89 kFx(kStatus) kDebugAlloc_Allocations(kDebugAlloc object, k64u since, kArrayList* history, kAlloc alloc);
90
100 kFx(kStatus) kDebugAlloc_LogAllocations(kDebugAlloc object, k64u since);
101
114 kFx(kStatus) kDebugAlloc_DetectLeakedObjects(kDebugAlloc object, k64u since);
115
129 kFx(kStatus) kDebugAlloc_DetectLeakedAssemblyObjects(kDebugAlloc object, k64u since, kAssembly assembly);
130
143 kFx(kStatus) kDebugAlloc_SetAllocListener(kDebugAlloc object, kCallbackFx function, kPointer receiver);
144
145 kEndHeader()
146
147 #include <kApi/Utils/kDebugAlloc.x.h>
148
149 #endif
kDebugAlloc::kDebugAlloc_Allocations
kStatus kDebugAlloc_Allocations(kDebugAlloc object, k64u since, kArrayList *history, kAlloc alloc)
Gets a list of all outstanding memory allocations performed after the given checkpoint.
k64u
Represents a 64-bit unsigned integer.
kDebugAllocation::size
kSize size
Size of memory allocation.
Definition: kDebugAlloc.h:26
kDebugAlloc::kDebugAlloc_SetAllocListener
kStatus kDebugAlloc_SetAllocListener(kDebugAlloc object, kCallbackFx function, kPointer receiver)
Registers a user-defined function that is called whenever a memory allocation occurs.
kAssembly
Represents a library of types.
kPointer
Represents a void pointer.
kDebugAllocation::index
k64u index
Incremented with each allocation.
Definition: kDebugAlloc.h:27
kDebugAlloc
Debug memory allocator that can track allocations and report leaks.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kDebugAlloc::kDebugAlloc_Allocated
kSize kDebugAlloc_Allocated(kDebugAlloc object)
Returns the total amount of memory that has been allocated and not yet freed.
kDebugAllocation::data
kByte * data
User data pointer.
Definition: kDebugAlloc.h:25
kDebugAlloc::kDebugAlloc_DetectLeakedObjects
kStatus kDebugAlloc_DetectLeakedObjects(kDebugAlloc object, k64u since)
Makes note of outstanding allocations that appear to be objects from any currently-loaded assembly...
kDebugAllocation::trace
kArrayList trace
Backtrace at point of allocation – kArrayList.
Definition: kDebugAlloc.h:28
kDebugAlloc::kDebugAlloc_Construct
kStatus kDebugAlloc_Construct(kDebugAlloc *object, const kChar *name, kAlloc allocator)
Constructs a new kDebugAlloc allocator.
kChar
Represents a single unit (byte) in a UTF-8 character.
kByte
Represents a byte on the current platform.
kDebugAlloc::kDebugAlloc_DetectLeakedAssemblyObjects
kStatus kDebugAlloc_DetectLeakedAssemblyObjects(kDebugAlloc object, k64u since, kAssembly assembly)
Makes note of outstanding allocations that appear to be objects associated with the specified assembl...
kApiDef.h
Core Zen type declarations.
kCallbackFx
kStatus(kCall * kCallbackFx)(kPointer receiver, kPointer sender, void *args)
Callback signature for a generic event handler.
Definition: kApiDef.h:1450
kArrayList
Represents a list implemented with a dynamic array.
kDebugAlloc::kDebugAlloc_Checkpoint
k64u kDebugAlloc_Checkpoint(kDebugAlloc object)
Returns a memory checkpoint value, used in conjunction with allocation logging functions.
kDebugAllocation
Allocation record used by kDebugAlloc.
Definition: kDebugAlloc.h:23
kStatus
Represents an error code.
kDebugAlloc::kDebugAlloc_LogAllocations
kStatus kDebugAlloc_LogAllocations(kDebugAlloc object, k64u since)
Logs all outstanding memory allocations performed after the given checkpoint (using kLogf)...
kDebugAlloc::kDebugAlloc_Clear
kStatus kDebugAlloc_Clear(kDebugAlloc object)
Clears all outstanding allocations (resets allocator).