Zen API
 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 {
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 
59 
68 
78 
90 kFx(kStatus) kDebugAlloc_Allocations(kDebugAlloc object, k64u since, kArrayList* history, kAlloc alloc);
91 
102 
116 
131 
144 kFx(kStatus) kDebugAlloc_SetAllocListener(kDebugAlloc object, kCallbackFx function, kPointer receiver);
145 
146 #endif
kStatus kDebugAlloc_Allocations(kDebugAlloc object, k64u since, kArrayList *history, kAlloc alloc)
Gets a list of all outstanding memory allocations performed after the given checkpoint.
Represents a 64-bit unsigned integer.
kSize size
Size of memory allocation.
Definition: kDebugAlloc.h:24
kStatus kDebugAlloc_SetAllocListener(kDebugAlloc object, kCallbackFx function, kPointer receiver)
Registers a user-defined function that is called whenever a memory allocation occurs.
Represents a library of types.
Represents a void pointer.
k64u index
Incremented with each allocation.
Definition: kDebugAlloc.h:25
Debug memory allocator that can track allocations and report leaks.
Represents an unsigned integer that can store a pointer address.
Abstract base class for memory allocator types.
kSize kDebugAlloc_Allocated(kDebugAlloc object)
Returns the total amount of memory that has been allocated and not yet freed.
kByte * data
User data pointer.
Definition: kDebugAlloc.h:23
kStatus kDebugAlloc_DetectLeakedObjects(kDebugAlloc object, k64u since)
Makes note of outstanding allocations that appear to be objects from any currently-loaded assembly...
kArrayList trace
Backtrace at point of allocation – kArrayList.
Definition: kDebugAlloc.h:26
Represents a single unit (byte) in a UTF-8 character.
Represents a byte on the current platform.
kStatus kDebugAlloc_DetectLeakedAssemblyObjects(kDebugAlloc object, k64u since, kAssembly assembly)
Makes note of outstanding allocations that appear to be objects associated with the specified assembl...
Core Zen type declarations.
kStatus(kCall * kCallbackFx)(kPointer receiver, kPointer sender, void *args)
Callback signature for a generic event handler.
Definition: kApiDef.h:1735
kStatus kDebugAlloc_Construct(kDebugAlloc *object, const kChar *name, kAlloc innerAlloc, kAlloc allocator)
Constructs a new kDebugAlloc allocator.
Represents a list implemented with a dynamic array.
k64u kDebugAlloc_Checkpoint(kDebugAlloc object)
Returns a memory checkpoint value, used in conjunction with allocation logging functions.
Allocation record used by kDebugAlloc.
Definition: kDebugAlloc.h:21
Represents an error code.
kStatus kDebugAlloc_LogAllocations(kDebugAlloc object, k64u since)
Logs all outstanding memory allocations performed after the given checkpoint (using kLogf)...
kStatus kDebugAlloc_Clear(kDebugAlloc object)
Clears all outstanding allocations (resets allocator).