Mercurial > hg > release > heapstats-2.0
changeset 196:25dbcd27c512
Bug 3322: TClassContainer instance might be broken in multithreaded access
Reviewed-by: SinTak
https://github.com/HeapStats/heapstats/pull/84
author | Yasumasa Suenaga <yasuenag@gmail.com> |
---|---|
date | Thu, 09 Feb 2017 12:29:01 +0900 |
parents | 61e865edcf55 |
children | 48703beb4d3d |
files | ChangeLog agent/src/heapstats-engines/classContainer.hpp agent/src/heapstats-engines/snapShotMain.cpp |
diffstat | 3 files changed, 6 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jan 29 21:49:39 2017 +0900 +++ b/ChangeLog Thu Feb 09 12:29:01 2017 +0900 @@ -1,3 +1,7 @@ +2017-02-09 Yasumasa Suenaga <yasuenag@gmail.com> + + * Bug 3322: TClassContainer instance might be broken in multithreaded access + 2017-01-24 KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp> * Bug 3296: Reference counter should manage TObjectData instance
--- a/agent/src/heapstats-engines/classContainer.hpp Sun Jan 29 21:49:39 2017 +0900 +++ b/agent/src/heapstats-engines/classContainer.hpp Thu Feb 09 12:29:01 2017 +0900 @@ -1,7 +1,7 @@ /*! * \file classContainer.hpp * \brief This file is used to add up using size every class. - * Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation + * Copyright (C) 2011-2017 Nippon Telegraph and Telephone Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -142,16 +142,6 @@ } /*! - * \brief Search class from container without container lock. - * \param klassOop [in] Target class oop. - * \return Class data of target class. - */ - inline TObjectData *findClassWithoutLock(void *klassOop) { - TClassMap::iterator it = classMap->find(klassOop); - return (it != classMap->end()) ? it->second : NULL; - } - - /*! * \brief Update class oop. * \param oldKlassOop [in] Target old class oop. * \param newKlassOop [in] Target new class oop.
--- a/agent/src/heapstats-engines/snapShotMain.cpp Sun Jan 29 21:49:39 2017 +0900 +++ b/agent/src/heapstats-engines/snapShotMain.cpp Thu Feb 09 12:29:01 2017 +0900 @@ -335,7 +335,7 @@ TObjectData *clsData = NULL; /* Search child class at local class container. */ - clsData = aClsContainer->findClassWithoutLock(klassOop); + clsData = aClsContainer->findClass(klassOop); if (unlikely(clsData == NULL)) { /* Search child class at root class container. */ clsData = clsContainer->findClass(klassOop);