diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-26 07:50:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-26 07:50:59 +0300 |
commit | cae59a78d84b1d61974d942538b4707a9565bb67 (patch) | |
tree | a463b34416ddaa83f0b61d3fcdea04dd931d7ef1 | |
parent | 04e32be958bb90be2824c083eba8f983d9133f76 (diff) |
print guarded-alloc memory leaks on blenderplayer exit.
-rw-r--r-- | release/scripts/templates/background_job.py | 2 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/release/scripts/templates/background_job.py b/release/scripts/templates/background_job.py index 90ddba8a91d..5cc2e04db0b 100644 --- a/release/scripts/templates/background_job.py +++ b/release/scripts/templates/background_job.py @@ -84,8 +84,6 @@ def main(): usage_text = "Run blender in background mode with this script:" usage_text += " blender --background --python " + __file__ + " -- [options]" - print(usage_text) - parser = argparse.ArgumentParser(description=usage_text) # Example background utility, add some text and renders or saves it (with options) diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 767ccff4259..65a68f1bac3 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -115,6 +115,12 @@ const int kMinWindowHeight = 100; char bprogname[FILE_MAX]; +static void mem_error_cb(const char *errorStr) +{ + fprintf(stderr, "%s", errorStr); + fflush(stderr); +} + #ifdef WIN32 typedef enum { @@ -834,9 +840,10 @@ int main(int argc, char** argv) // GPG_Application app (system, maggie, startscenename); app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ - BLI_strncpy(pathname, maggie->name, sizeof(pathname)); - BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name)); + if(G.main != maggie) { + BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name)); + } #ifdef WITH_PYTHON setGamePythonPath(G.main->name); #endif @@ -956,6 +963,13 @@ int main(int argc, char** argv) SYS_DeleteSystem(syshandle); + int totblock= MEM_get_memory_blocks_in_use(); + if(totblock!=0) { + printf("Error Totblock: %d\n",totblock); + MEM_set_error_callback(mem_error_cb); + MEM_printmemlist(); + } + return error ? -1 : 0; } |