diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-06-20 11:14:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-20 11:14:51 -0400 |
| commit | 64eec046f5a77ebad9564a935c4fad8df08ea6eb (patch) | |
| tree | 6077f00891210a5b092ef4f75af9684e6553166e /source | |
| parent | babe8e78d9f431d5f751859d159bbb3df37987c7 (diff) | |
Hot fix: Remove getExecutablePath reported memory leak (#993)
* Remove the memory leak that is being reported on Visual Stuio, due to getExecutablePath having a static local variable that is not freed before leaks are dumped. The solution is sort of clumsy, in so far as it just removes the cache. Would be nice to have a better way to handle such situations.
* Add to do comment - and also to push CI to rebuild.
Diffstat (limited to 'source')
| -rw-r--r-- | source/core/slang-io.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp index 3e0aa22a3..6cdd75c74 100644 --- a/source/core/slang-io.cpp +++ b/source/core/slang-io.cpp @@ -549,8 +549,12 @@ namespace Slang /* static */String Path::getExecutablePath() { - static String executablePath = _getExecutablePath(); - return executablePath; + // TODO(JS): It would be better if we lazily evaluated this, and then returned the same string on subsequent calls, because it has to do + // a fair amount of work depending on target. + // This was how previous code worked, with a static variable. Unfortunately this led to a memory leak being reported - because reporting + // is done before a global variable is released. + // It would be good to have a mechanism that allows 'core' library source free memory in some controlled manner. + return _getExecutablePath(); } Slang::String File::readAllText(const Slang::String& fileName) |
