--- a/hotspot/src/share/vm/opto/runtime.hpp Mon Aug 11 07:30:46 2014 -0700
+++ b/hotspot/src/share/vm/opto/runtime.hpp Mon Aug 11 10:18:09 2014 -0700
@@ -75,11 +75,17 @@
public:
NamedCounter(const char *n, CounterTag tag = NoTag):
- _name(n),
+ _name(n == NULL ? NULL : os::strdup(n)),
_count(0),
_next(NULL),
_tag(tag) {}
+ ~NamedCounter() {
+ if (_name != NULL) {
+ os::free((void*)_name);
+ }
+ }
+
const char * name() const { return _name; }
int count() const { return _count; }
address addr() { return (address)&_count; }