diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2024-05-28 11:31:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-28 11:31:03 -0700 |
| commit | c1e34c5a29d99d8a70b4e78313bfd3d539d9206e (patch) | |
| tree | 0eb0aea6b7f9b3d453c7cd65437b8f77364942ea /source/core/slang-std-writers.cpp | |
| parent | f6b755dc62df5ff796eb076ae1459a69746ee2f7 (diff) | |
Print memory leak info in Debug build of slangc.exe (#4210)
When memory leak is detected, this commit will dump the information
about the memory leak. This feature is available only in Debug build
on Windows platform.
Also note that the message will not be printed on the client
applications that use slang.dll, because the printing happens as a part
of slangc.exe not slang.dll.
I found a bug that Slang::StdWriters was closing `stdout` and `stderr`
in its destructor, which prevented Crt functions to print the messages
to `stdout` and `stderr`.
Diffstat (limited to 'source/core/slang-std-writers.cpp')
| -rw-r--r-- | source/core/slang-std-writers.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/core/slang-std-writers.cpp b/source/core/slang-std-writers.cpp index bf3ae72fd..a23d878fb 100644 --- a/source/core/slang-std-writers.cpp +++ b/source/core/slang-std-writers.cpp @@ -10,8 +10,8 @@ namespace Slang { RefPtr<StdWriters> stdWriters(new StdWriters); - RefPtr<FileWriter> stdError(new FileWriter(stderr, WriterFlag::AutoFlush)); - RefPtr<FileWriter> stdOut(new FileWriter(stdout, WriterFlag::AutoFlush)); + RefPtr<FileWriter> stdError(new FileWriter(stderr, WriterFlag::AutoFlush | WriterFlag::IsUnowned)); + RefPtr<FileWriter> stdOut(new FileWriter(stdout, WriterFlag::AutoFlush | WriterFlag::IsUnowned)); stdWriters->setWriter(SLANG_WRITER_CHANNEL_STD_ERROR, stdError); stdWriters->setWriter(SLANG_WRITER_CHANNEL_STD_OUTPUT, stdOut); |
