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
21 typedef struct kDebugAllocation
22 {
23 kByte* data;
24 kSize size;
25 k64u index;
26 kArrayList trace;
27 } kDebugAllocation;
28
29 #include <kApi/Utils/kDebugAlloc.x.h>
30
37 //typedef kAlloc kDebugAlloc; --forward-declared in kApiDef.x.h
38
49 kFx(kStatus) kDebugAlloc_Construct(kDebugAlloc* object, const kChar* name, kAlloc innerAlloc, kAlloc allocator);
50
58 kFx(kStatus) kDebugAlloc_Clear(kDebugAlloc object);
59
67 kFx(kSize) kDebugAlloc_Allocated(kDebugAlloc object);
68
77 kFx(k64u) kDebugAlloc_Checkpoint(kDebugAlloc object);
78
90 kFx(kStatus) kDebugAlloc_Allocations(kDebugAlloc object, k64u since, kArrayList* history, kAlloc alloc);
91
101 kFx(kStatus) kDebugAlloc_LogAllocations(kDebugAlloc object, k64u since);
102
115 kFx(kStatus) kDebugAlloc_DetectLeakedObjects(kDebugAlloc object, k64u since);
116
130 kFx(kStatus) kDebugAlloc_DetectLeakedAssemblyObjects(kDebugAlloc object, k64u since, kAssembly assembly);
131
144 kFx(kStatus) kDebugAlloc_SetAllocListener(kDebugAlloc object, kCallbackFx function, kPointer receiver);
145
146 #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:24
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:25
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:23
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:26
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:1737
kDebugAlloc::kDebugAlloc_Construct
kStatus kDebugAlloc_Construct(kDebugAlloc *object, const kChar *name, kAlloc innerAlloc, kAlloc allocator)
Constructs a new kDebugAlloc allocator.
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:21
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).