| 50 | } |
| 51 | |
| 52 | Result<std::shared_ptr<ResizableBuffer>> KernelContext::AllocateBitmap(int64_t num_bits) { |
| 53 | const int64_t nbytes = bit_util::BytesForBits(num_bits); |
| 54 | ARROW_ASSIGN_OR_RAISE(std::shared_ptr<ResizableBuffer> result, |
| 55 | AllocateResizableBuffer(nbytes, exec_ctx_->memory_pool())); |
| 56 | // Since bitmaps are typically written bit by bit, we could leak uninitialized bits. |
| 57 | // Make sure all memory is initialized (this also appeases Valgrind). |
| 58 | std::memset(result->mutable_data(), 0, result->size()); |
| 59 | return result; |
| 60 | } |
| 61 | |
| 62 | Status Kernel::InitAll(KernelContext* ctx, const KernelInitArgs& args, |
| 63 | std::vector<std::unique_ptr<KernelState>>* states) { |