fix(memory): increase memory counters by the actual size of reallocated memory
fix(memory): increase memory counters by the actual size of reallocated memory

On OSX, we had a test failure on memory module. The problem was in
the realloc function (line 38):

    void * realloc(void * ptr, size_t sz) {
        size_t old_sz = malloc_size(ptr);
        g_global_memory.dec(old_sz);
        g_global_memory.inc(sz);
        g_thread_memory.dec(old_sz);
        g_thread_memory.inc(sz);
        void * r = realloc_core(ptr, sz);
        if (r || sz == 0)
            return r;
        else
            ...

The size of r could be bigger than sz. For instance,

    |ptr| = 40 but |r| = 48

In the current code, here we only increase counters by 40.
But later when we free it, we decrease them by 48, and this
caused the problem, underflow of an unsigned counter in
g_global_memory.

fgdorais/lean,avigad/lean,fpvandoorn/lean2,johoelzl/lean,sp3ctum/lean,fpvandoorn/lean,leanprover-community/lean,eigengrau/lean,soonhokong/travis_test,digama0/lean,soonhokong/lean,eigengrau/lean,htzh/lean,johoelzl/lean,rlewis1988/lean,avigad/lean,fpvandoorn/lean2,sp3ctum/lean,soonhokong/lean-osx,Kha/lean,leanprover/lean,leodemoura/lean,sp3ctum/lean,fgdorais/lean,fpvandoorn/lean,johoelzl/lean,htzh/lean,rlewis1988/lean,c-cube/lean,javra/lean,soonhokong/lean-osx,eigengrau/lean,digama0/lean,rlewis1988/lean,fgdorais/lean,UlrikBuchholtz/lean,dselsam/lean,avigad/lean,avigad/lean,fpvandoorn/lean2,levnach/lean,soonhokong/lean,soonhokong/lean-windows,levnach/lean,dselsam/lean,codyroux/lean0.1,codyroux/lean0.1,soonhokong/lean-osx,leanprover/lean,c-cube/lean,dselsam/lean,digama0/lean,codyroux/lean0.1,UlrikBuchholtz/lean,fpvandoorn/lean,leanprover/lean,htzh/lean,javra/lean,johoelzl/lean,htzh/lean,leodemoura/lean,leodemoura/lean,digama0/lean,soonhokong/lean-osx,rlewis1988/lean,c-cube/lean,avigad/lean,soonhokong/lean,digama0/lean,rlewis1988/lean,UlrikBuchholtz/lean,sp3ctum/lean,soonhokong/lean-windows,soonhokong/lean-windows,leodemoura/lean,Kha/lean,Kha/lean,soonhokong/travis_test,leanprover-community/lean,levnach/lean,leanprover/lean,Kha/lean,c-cube/lean,sp3ctum/lean,soonhokong/travis_test,fgdorais/lean,levnach/lean,codyroux/lean0.1,eigengrau/lean,leodemoura/lean,dselsam/lean,javra/lean,johoelzl/lean,leanprover-community/lean,leodemoura/lean,fgdorais/lean,fpvandoorn/lean,soonhokong/travis_test,johoelzl/lean,soonhokong/lean-windows,fpvandoorn/lean,soonhokong/lean,leanprover-community/lean,leanprover/lean,leanprover-community/lean,soonhokong/lean-windows,leanprover/lean,UlrikBuchholtz/lean,c-cube/lean,dselsam/lean,rlewis1988/lean,soonhokong/lean,fgdorais/lean,digama0/lean,levnach/lean,dselsam/lean,fpvandoorn/lean2,Kha/lean,htzh/lean,avigad/lean,leanprover-community/lean,soonhokong/lean-osx,Kha/lean,eigengrau/lean,javra/lean,fpvandoorn/lean,fpvandoorn/lean2,UlrikBuchholtz/lean,javra/lean