mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
DumpHeapSnapShot memory leak bugfix
desc: DumpHeapSnapShot memory leak bugfix solu: 1. StreamWriter need release in deconstructing; 2. not if good, should be if is_open can close fileStream; issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I7LE8L Signed-off-by: wanghuan2022 <wanghuan80@huawei.com> Change-Id: I9c4cc04870b97b118e02e974eff513518961abae
This commit is contained in:
parent
dce64226bc
commit
dd213a33e0
@ -32,9 +32,14 @@ FileStream::FileStream(const std::string &fileName)
|
||||
Initialize(fileName);
|
||||
}
|
||||
|
||||
FileStream::~FileStream()
|
||||
{
|
||||
EndOfStream();
|
||||
}
|
||||
|
||||
void FileStream::EndOfStream()
|
||||
{
|
||||
if (Good()) {
|
||||
if (fileStream_.is_open()) {
|
||||
fileStream_.close();
|
||||
}
|
||||
}
|
||||
@ -50,7 +55,6 @@ void FileStream::Initialize(const std::string &fileName)
|
||||
std::pair<bool, std::string> realPath = FilePathValid(fileName);
|
||||
if (!realPath.first) {
|
||||
LOG_ECMA(ERROR) << "FileStream: check file path failed";
|
||||
fileStream_.close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace panda::ecmascript {
|
||||
class FileStream : public Stream {
|
||||
public:
|
||||
explicit FileStream(const std::string &fileName);
|
||||
~FileStream() override = default;
|
||||
~FileStream() override;
|
||||
|
||||
void EndOfStream() override;
|
||||
|
||||
|
@ -22,8 +22,9 @@ namespace panda::ecmascript {
|
||||
|
||||
HeapSnapshotJSONSerializer::~HeapSnapshotJSONSerializer()
|
||||
{
|
||||
if (!writer_) {
|
||||
if (writer_) {
|
||||
delete writer_;
|
||||
writer_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user