@@ -35,6 +35,10 @@ const _C_ON_SUBSCRIBE_COMPLETE = Ref{Ptr{Cvoid}}(C_NULL)
35
35
const _C_ON_UNSUBSCRIBE_COMPLETE = Ref {Ptr{Cvoid}} (C_NULL )
36
36
const _C_ON_RESUBSCRIBE_COMPLETE = Ref {Ptr{Cvoid}} (C_NULL )
37
37
const _C_ON_PUBLISH_COMPLETE = Ref {Ptr{Cvoid}} (C_NULL )
38
+ const _C_AWS_MALLOC = Ref {Ptr{Cvoid}} (C_NULL )
39
+ const _C_AWS_FREE = Ref {Ptr{Cvoid}} (C_NULL )
40
+ const _C_AWS_REALLOC = Ref {Ptr{Cvoid}} (C_NULL )
41
+ const _C_AWS_CALLOC = Ref {Ptr{Cvoid}} (C_NULL )
38
42
39
43
function _release (; include_mem_tracer = isempty (get (ENV , " AWS_CRT_MEMORY_TRACING" , " " )))
40
44
aws_thread_set_managed_join_timeout_ns (5e8 ) # 0.5 seconds
@@ -61,6 +65,8 @@ const advanced_use_note =
61
65
" default so that you can bring your own native data if you need to. However, you are then responsible for the " *
62
66
" memory management of that data."
63
67
68
+ include (" allocator.jl" )
69
+
64
70
include (" AWSIO.jl" )
65
71
export EventLoopGroup
66
72
export get_or_create_default_event_loop_group
@@ -139,6 +145,10 @@ function __init__()
139
145
)
140
146
_C_ON_PUBLISH_COMPLETE[] =
141
147
@cfunction (_c_on_publish_complete, Cvoid, (Ptr{aws_mqtt_client_connection}, Cuint, Cint, Ptr{Cvoid}))
148
+ _C_AWS_MALLOC[] = @cfunction (_c_aws_malloc, Ptr{Cvoid}, (Ptr{aws_allocator}, Csize_t))
149
+ _C_AWS_FREE[] = @cfunction (_c_aws_free, Cvoid, (Ptr{aws_allocator}, Ptr{Cvoid}))
150
+ _C_AWS_REALLOC[] = @cfunction (_c_aws_realloc, Ptr{Cvoid}, (Ptr{aws_allocator}, Ptr{Cvoid}, Csize_t, Csize_t))
151
+ _C_AWS_CALLOC[] = @cfunction (_c_aws_calloc, Ptr{Cvoid}, (Ptr{aws_allocator}, Csize_t, Csize_t))
142
152
143
153
_AWSCRT_ALLOCATOR[] = let level = get (ENV , " AWS_CRT_MEMORY_TRACING" , " " )
144
154
if ! isempty (level)
@@ -152,6 +162,8 @@ function __init__()
152
162
end
153
163
frames_per_stack = parse (Int, strip (get (ENV , " AWS_CRT_MEMORY_TRACING_FRAMES_PER_STACK" , " 0" )))
154
164
aws_mem_tracer_new (aws_default_allocator (), C_NULL , level, frames_per_stack)
165
+ elseif get (ENV , " AWS_CRT_USE_JL_ALLOCATOR" , " " ) == " true"
166
+ new_jl_allocator ()
155
167
else
156
168
aws_default_allocator ()
157
169
end
0 commit comments