added option to not use pool allocators (useful when using memory debugging tools)

This commit is contained in:
Arvid Norberg
2008-04-09 05:19:11 +00:00
parent 5a6e21f484
commit 75ef4ec1f1
6 changed files with 52 additions and 3 deletions

View File

@@ -135,8 +135,11 @@ namespace aux {
, fs::path const& logpath
#endif
)
: m_send_buffers(send_buffer_size)
, m_files(40)
:
#ifndef TORRENT_DISABLE_POOL_ALLOCATOR
m_send_buffers(send_buffer_size),
#endif
m_files(40)
, m_io_service()
, m_disk_thread(m_io_service)
, m_half_open(m_io_service)
@@ -2220,8 +2223,13 @@ namespace aux {
m_buffer_usage_logger << log_time() << " protocol_buffer: "
<< (m_buffer_allocations * send_buffer_size) << std::endl;
#endif
#ifdef TORRENT_DISABLE_POOL_ALLOCATOR
int num_bytes = num_buffers * send_buffer_size;
return std::make_pair((char*)malloc(num_bytes), num_bytes);
#else
return std::make_pair((char*)m_send_buffers.ordered_malloc(num_buffers)
, num_buffers * send_buffer_size);
#endif
}
void session_impl::free_buffer(char* buf, int size)
@@ -2238,7 +2246,11 @@ namespace aux {
m_buffer_usage_logger << log_time() << " protocol_buffer: "
<< (m_buffer_allocations * send_buffer_size) << std::endl;
#endif
#ifdef TORRENT_DISABLE_POOL_ALLOCATOR
free(buf);
#else
m_send_buffers.ordered_free(buf, num_buffers);
#endif
}
#ifndef NDEBUG