is00hcw / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

MallocExtension::GetStats() is not implemented #692

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Calling 

MallocExtension::instance()->GetStats(buffer, buffer_length);

per the documentation just places a null character in buffer, see 
malloc_extension.cc:125

void MallocExtension::GetStats(char* buffer, int length) {
  assert(length > 0);
  buffer[0] = '\0';
}

What is the expected output? What do you see instead?

I expected something resembling the output of 

static void DumpStats(TCMalloc_Printer* out, int level)()

What version of the product are you using? On what operating system?

2.4 on OS X 

Please provide any additional information below.

I could patch in a call to DumpStats but it's marked static so linking is a 
problem. I don't quite understand why it's marked such (other than it's nice 
not to muck with the global namespace). I could copy/paste the code around but 
that seems messy (likely the local change I'll make). 

If I understand the intent and the design issues I should be aware of I'm happy 
to patch it up. 

Original issue reported on code.google.com by m...@conlen.org on 30 May 2015 at 3:03

GoogleCodeExporter commented 9 years ago
Actual GetStats that's used is TCMallocImplementation::GetStats. Which replaces 
current_instance via MallocExtension::Register.

And GetStats is known to work.

Can I get your example program where GetStats returns bad result ?

Original comment by alkondratenko on 30 May 2015 at 5:24