Memory: Move to a normal model of ownership of memory pools, for new/delete.
Addresses step 4 of #976, overlaps #916. For each pool, now, it is newed, remembered, and freed by the same entity, rather than having a mix (thread finalize freeing current pool) that could lead to double freeing of the same pool. It is quite rational and simple now. This will enable reinstalling process and thread tear down.
This commit is contained in:
parent
be20905582
commit
4ceaab166c
2 changed files with 12 additions and 8 deletions
|
|
@ -1602,8 +1602,9 @@ public:
|
|||
};
|
||||
|
||||
TShader::TShader(EShLanguage s)
|
||||
: pool(0), stage(s), lengths(nullptr), stringNames(nullptr), preamble("")
|
||||
: stage(s), lengths(nullptr), stringNames(nullptr), preamble("")
|
||||
{
|
||||
pool = new TPoolAllocator;
|
||||
infoSink = new TInfoSink;
|
||||
compiler = new TDeferredCompiler(stage, *infoSink);
|
||||
intermediate = new TIntermediate(s);
|
||||
|
|
@ -1707,7 +1708,6 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion
|
|||
if (! InitThread())
|
||||
return false;
|
||||
|
||||
pool = new TPoolAllocator();
|
||||
SetThreadPoolAllocator(pool);
|
||||
if (! preamble)
|
||||
preamble = "";
|
||||
|
|
@ -1731,7 +1731,6 @@ bool TShader::preprocess(const TBuiltInResource* builtInResources,
|
|||
if (! InitThread())
|
||||
return false;
|
||||
|
||||
pool = new TPoolAllocator();
|
||||
SetThreadPoolAllocator(pool);
|
||||
if (! preamble)
|
||||
preamble = "";
|
||||
|
|
@ -1752,8 +1751,9 @@ const char* TShader::getInfoDebugLog()
|
|||
return infoSink->debug.c_str();
|
||||
}
|
||||
|
||||
TProgram::TProgram() : pool(0), reflection(0), ioMapper(nullptr), linked(false)
|
||||
TProgram::TProgram() : reflection(0), ioMapper(nullptr), linked(false)
|
||||
{
|
||||
pool = new TPoolAllocator;
|
||||
infoSink = new TInfoSink;
|
||||
for (int s = 0; s < EShLangCount; ++s) {
|
||||
intermediate[s] = 0;
|
||||
|
|
@ -1788,7 +1788,6 @@ bool TProgram::link(EShMessages messages)
|
|||
|
||||
bool error = false;
|
||||
|
||||
pool = new TPoolAllocator();
|
||||
SetThreadPoolAllocator(pool);
|
||||
|
||||
for (int s = 0; s < EShLangCount; ++s) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue