[ create a new paste ] login | about

Link: http://codepad.org/xqOoW7rB    [ raw code | fork ]

Plain Text, pasted on Aug 29:
diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx
index 8e7622e..ea6890d 100644
--- a/src/Scripting/NasalSys.cxx
+++ b/src/Scripting/NasalSys.cxx
@@ -60,6 +60,11 @@ void postinitNasalGUI(naRef globals, naContext c);
 
 static FGNasalSys* nasalSys = 0;
 
+static
+void TrackGarbageCollectionCallback(unsigned int refs, unsigned int objs) {
+	SG_LOG(SG_NASAL, SG_ALERT, "Nasal GC: References:"<<refs<< " Objects:"<<objs);
+}
+
 // Listener class for loading Nasal modules on demand
 class FGNasalModuleListener : public SGPropertyChangeListener
 {
@@ -819,6 +824,9 @@ void FGNasalSys::init()
 
     _context = naNewContext();
 
+    // register a custom GC tracking callback
+    registerGCTracker(&TrackGarbageCollectionCallback);
+
     // Start with globals.  Add it to itself as a recursive
     // sub-reference under the name "globals".  This gives client-code
     // write access to the namespace if someone wants to do something
@@ -875,6 +883,7 @@ void FGNasalSys::init()
     simgear::PathList directories = nasalDir.children(simgear::Dir::TYPE_DIR+
             simgear::Dir::NO_DOT_OR_DOTDOT, "");
     for (unsigned int i=0; i<directories.size(); ++i) {
+	SG_LOG(SG_NASAL, SG_ALERT, "Adding Nasal module:" << directories[i].file() );
         simgear::Dir dir(directories[i]);
         simgear::PathList scripts = dir.children(simgear::Dir::TYPE_FILE, ".nas");
         addModule(directories[i].file(), scripts);



Create a new paste based on this one


Comments: