merge memory allocation fix from RC_0_16
This commit is contained in:
@@ -23,6 +23,10 @@
|
|||||||
* fix uTP edge case where udp socket buffer fills up
|
* fix uTP edge case where udp socket buffer fills up
|
||||||
* fix nagle implementation in uTP
|
* fix nagle implementation in uTP
|
||||||
|
|
||||||
|
* fix memory allocation issue (virtual addres space waste) on windows
|
||||||
|
|
||||||
|
0.16.11 release
|
||||||
|
|
||||||
* fix web seed URL double escape issue
|
* fix web seed URL double escape issue
|
||||||
* fix string encoding issue in alert messages
|
* fix string encoding issue in alert messages
|
||||||
* fix SSL authentication issue
|
* fix SSL authentication issue
|
||||||
|
@@ -44,8 +44,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <unistd.h> // _SC_PAGESIZE
|
#include <unistd.h> // _SC_PAGESIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TORRENT_USE_MEMALIGN || TORRENT_USE_POSIX_MEMALIGN
|
#if TORRENT_USE_MEMALIGN || TORRENT_USE_POSIX_MEMALIGN || defined TORRENT_WINDOWS
|
||||||
#include <malloc.h> // memalign
|
#include <malloc.h> // memalign and _aligned_malloc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG_BUFFERS
|
#ifdef TORRENT_DEBUG_BUFFERS
|
||||||
@@ -90,6 +90,8 @@ namespace libtorrent
|
|||||||
|
|
||||||
char* page_aligned_allocator::malloc(size_type bytes)
|
char* page_aligned_allocator::malloc(size_type bytes)
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT(bytes >= page_size());
|
||||||
|
TORRENT_ASSERT(bytes % page_size() == 0);
|
||||||
#ifdef TORRENT_DEBUG_BUFFERS
|
#ifdef TORRENT_DEBUG_BUFFERS
|
||||||
int page = page_size();
|
int page = page_size();
|
||||||
int num_pages = (bytes + (page-1)) / page + 2;
|
int num_pages = (bytes + (page-1)) / page + 2;
|
||||||
@@ -115,7 +117,7 @@ namespace libtorrent
|
|||||||
#elif TORRENT_USE_MEMALIGN
|
#elif TORRENT_USE_MEMALIGN
|
||||||
return (char*)memalign(page_size(), bytes);
|
return (char*)memalign(page_size(), bytes);
|
||||||
#elif defined TORRENT_WINDOWS
|
#elif defined TORRENT_WINDOWS
|
||||||
return (char*)VirtualAlloc(0, bytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
return (char*)_aligned_malloc(bytes, page_size());
|
||||||
#elif defined TORRENT_BEOS
|
#elif defined TORRENT_BEOS
|
||||||
void* ret = 0;
|
void* ret = 0;
|
||||||
area_id id = create_area("", &ret, B_ANY_ADDRESS
|
area_id id = create_area("", &ret, B_ANY_ADDRESS
|
||||||
@@ -149,7 +151,7 @@ namespace libtorrent
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
VirtualFree(block, 0, MEM_RELEASE);
|
_aligned_free(block);
|
||||||
#elif defined TORRENT_BEOS
|
#elif defined TORRENT_BEOS
|
||||||
area_id id = area_for(block);
|
area_id id = area_for(block);
|
||||||
if (id < B_OK) return;
|
if (id < B_OK) return;
|
||||||
|
Reference in New Issue
Block a user