1//
2// HTTPBufferAllocator.cpp
3//
4// Library: Net
5// Package: HTTP
6// Module: HTTPBufferAllocator
7//
8// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
9// and Contributors.
10//
11// SPDX-License-Identifier: BSL-1.0
12//
13
14
15#include "Poco/Net/HTTPBufferAllocator.h"
16
17
18using Poco::MemoryPool;
19
20
21namespace Poco {
22namespace Net {
23
24
25MemoryPool HTTPBufferAllocator::_pool(HTTPBufferAllocator::BUFFER_SIZE, 16);
26
27
28char* HTTPBufferAllocator::allocate(std::streamsize size)
29{
30 poco_assert_dbg (size == BUFFER_SIZE);
31
32 return reinterpret_cast<char*>(_pool.get());
33}
34
35
36void HTTPBufferAllocator::deallocate(char* ptr, std::streamsize size)
37{
38 poco_assert_dbg (size == BUFFER_SIZE);
39
40 _pool.release(ptr);
41}
42
43
44} } // namespace Poco::Net
45