8259710: Inlining trace leaks memory

Reviewed-by: thartmann, neliasso
This commit is contained in:
Thomas Stuefe 2021-01-25 10:50:39 +00:00
parent 09489e28bd
commit ca20c63c04
2 changed files with 25 additions and 29 deletions

View file

@ -392,24 +392,23 @@ class Compile : public Phase {
// Inlining may not happen in parse order which would make
// PrintInlining output confusing. Keep track of PrintInlining
// pieces in order.
class PrintInliningBuffer : public ResourceObj {
class PrintInliningBuffer : public CHeapObj<mtCompiler> {
private:
CallGenerator* _cg;
stringStream* _ss;
stringStream _ss;
static const size_t default_stream_buffer_size = 128;
public:
PrintInliningBuffer()
: _cg(NULL) { _ss = new stringStream(); }
: _cg(NULL), _ss(default_stream_buffer_size) {}
void freeStream() { _ss->~stringStream(); _ss = NULL; }
stringStream* ss() const { return _ss; }
CallGenerator* cg() const { return _cg; }
stringStream* ss() { return &_ss; }
CallGenerator* cg() { return _cg; }
void set_cg(CallGenerator* cg) { _cg = cg; }
};
stringStream* _print_inlining_stream;
GrowableArray<PrintInliningBuffer>* _print_inlining_list;
GrowableArray<PrintInliningBuffer*>* _print_inlining_list;
int _print_inlining_idx;
char* _print_inlining_output;
@ -429,7 +428,7 @@ class Compile : public Phase {
void print_inlining_reinit();
void print_inlining_commit();
void print_inlining_push();
PrintInliningBuffer& print_inlining_current();
PrintInliningBuffer* print_inlining_current();
void log_late_inline_failure(CallGenerator* cg, const char* msg);
DEBUG_ONLY(bool _exception_backedge;)