3 ms·
I'm a C programmmer and I rarely call malloc() and free(). Most memory is allocated in more global contexts that comprises many smaller allocastions. Such cont
by jstimpfle 4y ago
I'm a C programmmer and I rarely call malloc() and free(). Most memory is allocated in more global contexts that comprises many smaller allocastions. Such contexts get freed at appropriate, more global points, if at all. Often the implicit releasing of memory on process exit, done by the OS, is sufficient. This way removes the need to do memory management on a small scale.
The problem I see personally with unique_ptr is that it's still doing small-scale memory management. It only removes some of the typing. (And for non memory management related tasks, it add significant amount of typing as well, compared to naked pointers).