Skip to content

Commit

Permalink
use GC.malloc_atomic to allocate objects without pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
kostya committed Feb 26, 2017
1 parent c2c2276 commit 2d05f97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/base64.cr
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ module Base64
# This will decode either the normal or urlsafe alphabets.
def decode(data) : Bytes
slice = data.to_slice
buf = Pointer(UInt8).malloc(decode_size(slice.size))
buf = GC.malloc_atomic(decode_size(slice.size)).as(UInt8*)
appender = buf.appender
from_base64(slice) { |byte| appender << byte }
Slice.new(buf, appender.size.to_i32)
Expand Down

0 comments on commit 2d05f97

Please sign in to comment.