Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 279606 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-14 / +17 lines)
Line  Link Here
0
-- trunk/c++/src/app/netcache/nc_memory.cpp    2011/12/16 17:42:54     52330
0
++ trunk/c++/src/app/netcache/nc_memory.cpp    2012/02/27 14:38:30     53136
Lines 360-366 Link Here
360
    m_ObjLock.Lock();
360
    m_ObjLock.Lock();
361
    ++m_SysFrees;
361
    ++m_SysFrees;
362
    m_SystemMem -= alloced_size;
362
    m_SystemMem -= alloced_size;
363
    m_LostMem   -= alloced_size -= asked_size;
363
    m_LostMem   -= alloced_size - asked_size;
364
    m_ObjLock.Unlock();
364
    m_ObjLock.Unlock();
365
}
365
}
366
366
Lines 2539-2545 Link Here
2539
bool
2539
bool
2540
CNCMemManager::InitializeApp(void)
2540
CNCMemManager::InitializeApp(void)
2541
{
2541
{
2542
    try {
2542
    /*try {
2543
        CSQLITE_Global::SetCustomMallocFuncs(&s_NCMallocMethods);
2543
        CSQLITE_Global::SetCustomMallocFuncs(&s_NCMallocMethods);
2544
    }
2544
    }
2545
    catch (CSQLITE_Exception& ex) {
2545
    catch (CSQLITE_Exception& ex) {
Lines 2547-2559 Link Here
2547
        return false;
2547
        return false;
2548
    }
2548
    }
2549
2549
2550
    return CNCMMCentral::RunLateInit();
2550
    return CNCMMCentral::RunLateInit();*/
2551
    g_InitNCThreadIndexes();
2552
    return true;
2551
}
2553
}
2552
2554
2553
void
2555
void
2554
CNCMemManager::FinalizeApp(void)
2556
CNCMemManager::FinalizeApp(void)
2555
{
2557
{
2556
    CNCMMCentral::PrepareToStop();
2558
    //CNCMMCentral::PrepareToStop();
2557
}
2559
}
2558
2560
2559
void
2561
void
Lines 2571-2598 Link Here
2571
void
2573
void
2572
CNCMemManager::PrintStats(CPrintTextProxy& proxy)
2574
CNCMemManager::PrintStats(CPrintTextProxy& proxy)
2573
{
2575
{
2574
    CNCMMStats stats_sum;
2576
    /*CNCMMStats stats_sum;
2575
    CNCMMStats::CollectAllStats(&stats_sum);
2577
    CNCMMStats::CollectAllStats(&stats_sum);
2576
    stats_sum.Print(proxy);
2578
    stats_sum.Print(proxy);*/
2577
}
2579
}
2578
2580
2579
size_t
2581
size_t
2580
CNCMemManager::GetMemoryLimit(void)
2582
CNCMemManager::GetMemoryLimit(void)
2581
{
2583
{
2582
    return CNCMMCentral::GetMemLimit();
2584
    return 0;//CNCMMCentral::GetMemLimit();
2583
}
2585
}
2584
2586
2585
size_t
2587
size_t
2586
CNCMemManager::GetMemoryUsed(void)
2588
CNCMemManager::GetMemoryUsed(void)
2587
{
2589
{
2588
    CNCMMStats stat;
2590
    /*CNCMMStats stat;
2589
    CNCMMStats::CollectAllStats(&stat);
2591
    CNCMMStats::CollectAllStats(&stat);
2590
    return stat.GetSystemMem();
2592
    return stat.GetSystemMem();*/
2593
    return 0;
2591
}
2594
}
2592
2595
2593
END_NCBI_SCOPE
2596
END_NCBI_SCOPE
2594
2597
2595
2598
/*
2596
void*
2599
void*
2597
operator new (size_t size)
2600
operator new (size_t size)
2598
#ifndef NCBI_COMPILER_MSVC
2601
#ifndef NCBI_COMPILER_MSVC
Lines 2626-2638 Link Here
2626
{
2629
{
2627
    NCBI_NS_NCBI::CNCMMCentral::DeallocMemory(ptr);
2630
    NCBI_NS_NCBI::CNCMMCentral::DeallocMemory(ptr);
2628
}
2631
}
2629
2632
*/
2630
#ifdef __GLIBC__
2633
#ifdef __GLIBC__
2631
// glibc has special method of overriding C library allocation functions.
2634
// glibc has special method of overriding C library allocation functions.
2632
2635
2633
#include <malloc.h>
2636
#include <malloc.h>
2634
2637
2635
2638
/*
2636
void* s_NCMallocHook(size_t size, const void* caller)
2639
void* s_NCMallocHook(size_t size, const void* caller)
2637
{
2640
{
2638
    return NCBI_NS_NCBI::CNCMMCentral::AllocMemory(size);
2641
    return NCBI_NS_NCBI::CNCMMCentral::AllocMemory(size);
Lines 2656-2662 Link Here
2656
}
2659
}
2657
2660
2658
void (*__malloc_initialize_hook) (void) = s_NCInitMallocHook;
2661
void (*__malloc_initialize_hook) (void) = s_NCInitMallocHook;
2659
2662
*/
2660
#elif !defined(NCBI_OS_MSWIN)
2663
#elif !defined(NCBI_OS_MSWIN)
2661
// Changing of C library allocation functions on Windows is very tricky (if
2664
// Changing of C library allocation functions on Windows is very tricky (if
2662
// possible at all) and NetCache will never run in production on Windows. So
2665
// possible at all) and NetCache will never run in production on Windows. So

Return to bug 279606