Github user jpeach commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/622#discussion_r62565638 --- Diff: iocore/eventsystem/IOBuffer.cc --- @@ -271,3 +272,74 @@ IOBufferReader::memcpy(const void *ap, int64_t len, int64_t offset) return p; } + +void * +ats_malloc_pool(size_t size) +{ + void *ptr = NULL; + size_t total_required_size = size + sizeof(uint64_t); + + if (likely(size > 0)) { + if (unlikely(total_required_size > DEFAULT_MAX_BUFFER_SIZE)) { + // we need to fall back to ats_malloc for large allocations + ptr = ats_malloc(total_required_size); + } else { + int64_t iobuffer_index = iobuffer_size_to_index(total_required_size); + ink_release_assert(iobuffer_index >= 0); + + ptr = ioBufAllocator[iobuffer_index].alloc_void(); + Debug("allocator_pool", + "Allocating a block from iobuf index %ld (block size %ld), requested_size = %ld, alloc size = %ld at location %p", + iobuffer_index, index_to_buffer_size(iobuffer_index), size, total_required_size, ptr); + } --- End diff -- This looks really similar to ``IOBufferData::alloc``?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---