Question: I want to access a "number" in a const char\* array, subtract a number from another const char\* array and then save the result back in the first const char\* array.  

I have this code working just fine on Linux, but in Windows (VS 2015 RC) it just doesn't work. 

```
int i = atoi(CharArr1[0][6]); //if printed shows 100
i -= atoi(CharArr2[0][2]); //if printed shows 93 (100-7)
CharArr1[0][6] = std::to_string(i).c_str(); //if I print the conversion, it shows 93 | if I print CharArr1[0][6] it shows nothing

```

Thanks in advance for answers.

Answer: 
Turned out quite an interesting and a surprising problem!

The real cause of this is memory fragmentation in the allocator they are using (`dlmalloc`). 
Hopefully MSFT are going to make this better but I expect this would take some time.

In the meantime, the workaround.

**Proper way of fixing this (for now)**

Configure both `maxmemory` and `maxheap` parameters. Make `maxheap` much larger than `maxmemory`.

So if you want `maxmemory=100MB` then make `maxheap` 5x or even 10x larger, e.g `maxheap=500MB` or even `maxheap=1000MB`.
I don't think there is a good rule of thumb how much larger `maxheap` needs to be which is why it's such a tricky problem.

The effect of this: Redis will still try and keep the memory usage under `100MB`, but the actual physical memory in use may
be larger than that, potentially up to `maxheap` value. How much exactly depends on the level of fragmentation. Hopefully
in real life this would stay at reasonable levels.

---

I have logged the issue with the team. <https://github.com/MSOpenTech/redis/issues/274>

---

**EDIT**: I've completely reworked this answer in light of new knowledge. See previous versions in the edit history.
Use this command to set max heap size it will definetely work 

> 
> redis-server redis.windows.conf –-maxheap 1gb
> 
> 
>