java-gobject-introspection r140 - trunk/src/org/gnome/gir/gobject
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r140 - trunk/src/org/gnome/gir/gobject
- Date: Sun, 30 Nov 2008 22:03:46 +0000 (UTC)
Author: walters
Date: Sun Nov 30 22:03:46 2008
New Revision: 140
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=140&view=rev
Log:
Add -Djgir.debugMemory=[final|full]
Modified:
trunk/src/org/gnome/gir/gobject/GObject.java
trunk/src/org/gnome/gir/gobject/NativeObject.java
Modified: trunk/src/org/gnome/gir/gobject/GObject.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GObject.java (original)
+++ trunk/src/org/gnome/gir/gobject/GObject.java Sun Nov 30 22:03:46 2008
@@ -91,7 +91,13 @@
}
NativeObject.Internals.debugMemory(fmt, newArgs);
}
- }
+ }
+
+ private static final void debugMemoryFinal(GObject obj, String fmt, Object... args) {
+ if (!NativeObject.Internals.debugMemoryFinalization)
+ return;
+ debugMemory(obj, fmt, args);
+ }
/**
* A tagging interface to mark classes which are GObject property bags.
@@ -254,7 +260,7 @@
if (disposed)
return;
/* Take away the toggle reference */
- debugMemory(this, "REMOVING TOGGLE %s %s%n");
+ debugMemoryFinal(this, "REMOVING TOGGLE %s %s%n");
GObjectAPI.gobj.g_object_remove_toggle_ref(getNativeAddress(), toggle, objectID);
}
@@ -340,7 +346,7 @@
@Override
public void callback(Pointer data, Pointer obj) {
GObject o = (GObject) Internals.instanceFor(obj);
- NativeObject.Internals.debugMemory("WEAK %s target=%s%n", obj, o);
+ NativeObject.Internals.debugMemoryFinal("WEAK %s target=%s%n", obj, o);
if (o == null)
return;
synchronized (o) {
Modified: trunk/src/org/gnome/gir/gobject/NativeObject.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/NativeObject.java (original)
+++ trunk/src/org/gnome/gir/gobject/NativeObject.java Sun Nov 30 22:03:46 2008
@@ -121,9 +121,12 @@
public static class Internals {
public static final boolean debugMemory;
+ public static final boolean debugMemoryFinalization;
static {
- debugMemory = System.getProperty("jgir.debugMemory") != null;
+ String debug = System.getProperty("jgir.debugMemory");
+ debugMemoryFinalization = debug != null ? debug.equals("final") : false;
+ debugMemory = debug != null ? debug.equals("all") : false;
}
public static void debugMemory(String fmt, Object...args) {
@@ -131,6 +134,12 @@
return;
System.err.printf(fmt, args);
}
+
+ public static void debugMemoryFinal(String fmt, Object...args) {
+ if (!(debugMemoryFinalization || debugMemory))
+ return;
+ System.err.printf(fmt, args);
+ }
protected static NativeObject instanceFor(Pointer ptr) {
WeakReference<NativeObject> ref = NativeObject.instanceMap.get(ptr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]