How does memory manager work?

Revision en1, by UnknownNooby, 2016-08-22 12:46:36

Recently, one guy posted this blog, and couldn't understand what was really wrong with his code. It turns out that his code was wrong anyway, but I've noticed one thing:

Take a look at these two submissions: TL and OK.

In both solutions I am using self-written vector class, but the difference between these two codes, obviously is that in the OK code I do not use the delete[] operator, thus it takes less time to destruct my class, but doesn't free the memory on destruction (which can be seen by memory taken by solution).

Solutions take about this much time on my machine:

No vects:                  248ms
Vects with no destruction: 370ms
Vects with destruction:    948ms 

The question stands: Why is delete[] operation so slow and where can I read about memory manager in c++? Google only leads me to things like "writing your own memory manager in c++" which is actually interesting, but unfortunately hard to read and that's not exactly the case I'm looking for.


  Rev. Lang. By When Δ Comment
ru1 Russian UnknownNooby 2016-08-22 18:54:48 1108 Первая редакция перевода на Русский
en1 English UnknownNooby 2016-08-22 12:46:36 1191 Initial revision (published)