Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GafferModule : Windows verifyAllocator() #6087

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Improvements
------------

- Light Editor : Added `is_sphere` column for Cycles lights.

- Windows : Gaffer now uses the TBB memory allocator for significantly better performance.


1.5.0.0a3 (relative to 1.5.0.0a2)
Expand Down
3 changes: 3 additions & 0 deletions bin/__gaffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@

import IECore

if os.name == "nt" :
Gaffer._Gaffer._verifyAllocator()

# Increase the soft limit for file handles as high as we can - we need everything we can get for
# opening models, textures etc.
if os.name != "nt" :
Expand Down
28 changes: 28 additions & 0 deletions src/GafferModule/GafferModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
#include <sys/prctl.h>
#endif

#ifdef _MSC_VER
#include "IECore/MessageHandler.h"

#include "tbb/tbbmalloc_proxy.h"
#endif

using namespace boost::python;
using namespace Gaffer;
using namespace GafferModule;
Expand Down Expand Up @@ -187,6 +193,25 @@ void nameProcess()
#endif
}

#ifdef _MSC_VER
void verifyAllocator()
{

char **replacementLog;
int replacementStatus = TBB_malloc_replacement_log( &replacementLog );

if( replacementStatus != 0 )
{
IECore::msg( IECore::Msg::Warning, "Gaffer", "Failed to install TBB memory allocator. Performance may be degraded." );
for( char **logEntry = replacementLog; *logEntry != 0; logEntry++ )
{
IECore::msg( IECore::Msg::Warning, "Gaffer", *logEntry );
}
}

}
#endif

} // namespace

// Arrange for `storeArgcArgv()` to be called when our module loads,
Expand Down Expand Up @@ -257,5 +282,8 @@ BOOST_PYTHON_MODULE( _Gaffer )
def( "isDebug", &isDebug );

def( "_nameProcess", &nameProcess );
#ifdef _MSC_VER
def( "_verifyAllocator", &verifyAllocator );
#endif

}
Loading