# Consider some heap optimizations

**URL:** https://discourse.cmake.org/t/consider-some-heap-optimizations/1761
**Category:** Development
**Created:** [August 30, 2020, 8:34pm UTC](https://discourse.cmake.org/t/consider-some-heap-optimizations/1761 "2020-08-30T20:34:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![OleksandrKvl](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/a88e4f/32.png) [@OleksandrKvl](https://discourse.cmake.org/u/OleksandrKvl)
#### Post date: [August 30, 2020, 8:34pm UTC](https://discourse.cmake.org/t/consider-some-heap-optimizations/1761/1 "2020-08-30T20:34:27Z")

</div>

Hi, I’ve made some heap optimizations, details are here: [Reducing CMake heap usage with Heaptrack](https://oleksandrkvl.github.io/2020/08/30/reducing-cmake-heap-usage.html).  
TL;DR: I changed `cmListFunction` to be a `std::shared_ptr` and did a couple of another little changes, you can find them all in this [branch history](https://github.com/OleksandrKvl/CMake/commits/optimized/Source). It was mostly small research and heaptrack test for me so I’ll understand if such optimizations wouldn’t be considered significant enough.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [August 31, 2020, 2:02pm UTC](https://discourse.cmake.org/t/consider-some-heap-optimizations/1761/2 "2020-08-31T14:02:10Z")

</div>

Cc: @marc.chevrier @ben.boeckel

@OleksandrKvl thanks! We do occasionally do memory profiling optimizations and it has been a while since the last time, so such improvements would certainly be welcome! Please see [CONTRIBUTING.rst](https://gitlab.kitware.com/cmake/cmake/-/blob/master/CONTRIBUTING.rst) for contribution instructions. We can review the details in a merge request.

---

<div class="post-metadata">

### Author: ![OleksandrKvl](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/a88e4f/32.png) [@OleksandrKvl](https://discourse.cmake.org/u/OleksandrKvl)
#### Post date: [August 31, 2020, 6:49pm UTC](https://discourse.cmake.org/t/consider-some-heap-optimizations/1761/3 "2020-08-31T18:49:31Z")

</div>

Ok, I’ll prepare a merge request)

---

<div class="post-metadata">

### Author: ![OleksandrKvl](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/a88e4f/32.png) [@OleksandrKvl](https://discourse.cmake.org/u/OleksandrKvl)
#### Post date: [September 2, 2020, 11:18am UTC](https://discourse.cmake.org/t/consider-some-heap-optimizations/1761/4 "2020-09-02T11:18:55Z")

</div>

Here it is [https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/5178](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5178)
