Transactional Pointers: Experiences with HTM-Based Reference Counting in C++

  • Maria Carpen-AmarieEmail author
  • Dave Dice
  • Gaël Thomas
  • Pascal Felber
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9944)


The most popular programming languages, such as C++ or Java, have libraries and data structures designed to automatically address concurrency hazards in order to run on multiple threads. In particular, this trend has also been adopted in the memory management domain. However, automatic concurrent memory management also comes at a price, leading sometimes to noticeable overhead. In this paper, we experiment with C++ smart pointers and their automatic memory-management technique based on reference counting. More precisely, we study how we can use hardware transactional memory (HTM) to avoid costly and sometimes unnecessary atomic operations. Our results suggest that replacing the systematic counting strategy with HTM could improve application performance in certain scenarios, such as concurrent linked-list traversal.


  1. 1.
    Blackburn, S.M., McKinley, K.S.: Ulterior reference counting: fast garbage collection without a long wait. In: Proceedings of the 18th Annual ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications, pp. 344–358. ACM, USA (2003)Google Scholar
  2. 2.
    Bonnichsen, L.F., Probst, C.W., Karlsson, S.: Hardware transactional memory optimization guidelines, applied to ordered maps. In: Trustcom/BigDataSE/ISPA, 2015 IEEE, vol. 3, pp. 124–131. IEEE (2015)Google Scholar
  3. 3.
    Cascaval, C., Blundell, C., Michael, M., Cain, H.W., Wu, P., Chiras, S., Chatterjee, S.: Software transactional memory: why is it only a research toy? Queue 6(5), 40:46–40:58 (2008)CrossRefGoogle Scholar
  4. 4.
    Crowl, L., Lev, Y., Luchangco, V., Moir, M., Nussbaum, D.: Integrating transactional memory into C++. In: Workshop on Transactional Computing (2007)Google Scholar
  5. 5.
    David, T., Guerraoui, R., Trigonakis, V.: Asynchronized concurrency: the secret to scaling concurrent search data structures. In: Proceedings of the 20th International Conference on Architectural Support for Programming Languages and Operating Systems, pp. 631–644. ACM (2015)Google Scholar
  6. 6.
    Dragojević, A., Felber, P., Gramoli, V., Guerraoui, R.: Why STM can be more than a research toy. Commun. ACM 54(4), 70–77 (2011)CrossRefGoogle Scholar
  7. 7.
    Gottschlich, J.E., Boehm, H.J.: Generic programming needs transactional memory. In: The 8th ACM SIGPLAN Workshop on Transactional Computing (2013)Google Scholar
  8. 8.
    Herlihy, M., Moss, J.E.B.: Transactional memory: architectural support for lock-free data structures. In: Proceedings of the 20th Annual International Symposium on Computer Architecture, pp. 289–300. ACM, USA (1993)Google Scholar
  9. 9.
    Herlihy, M., Shavit, N.: The Art of Multiprocessor Programming. Morgan Kaufmann Publishers Inc., Burlington (2008)Google Scholar
  10. 10.
    Ni, Y., Welc, A., Adl-Tabatabai, A.R., Bach, M., Berkowits, S., Cownie, J., Geva, R., Kozhukow, S., Narayanaswamy, R., Olivier, J., Preis, S., Saha, B., Tal, A., Tian, X.: Design and implementation of transactional constructs for C/C++. In: Proceedings of the 23rd ACM SIGPLAN Conference on Object-Oriented Programming Systems Languages and Applications, pp. 195–212. ACM, USA (2008)Google Scholar
  11. 11.
    Shahriyar, R., Blackburn, S.M., Frampton, D.: Down for the count? Getting reference counting back in the ring. In: Proceedings of the 2012 International Symposium on Memory Management, pp. 73–84. ACM, USA (2012)Google Scholar
  12. 12.
    Shahriyar, R., Blackburn, S.M., Yang, X., McKinley, K.S.: Taking off the gloves with reference counting Immix. In: Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages and Applications, pp. 93–110. ACM, USA (2013)Google Scholar

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  • Maria Carpen-Amarie
    • 1
    Email author
  • Dave Dice
    • 2
  • Gaël Thomas
    • 3
  • Pascal Felber
    • 1
  1. 1.Université de NeuchâtelNeuchâtelSwitzerland
  2. 2.Oracle LabsBurlingtonUSA
  3. 3.Telecom SudParisÉvryFrance

Personalised recommendations