Warning: session_start(): open(/var/lib/php/sessions/sess_ggvvv7c6p4u227pfp598ule82u, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// I guess "transitive total object size" or something
// would be a better name.
sclass RecursiveObjectSize {
long size;
new SimpleStack stack;
Set seen = new CompactIdentityHashSet; // add objects here to ignore them
Set fieldsToIgnore;
Set realmsToIgnore;
settable bool skipTransientFields;
swappable void onNewObject(O o) {}
swappable void onSizeChanged() {}
swappable bool shouldIgnore(O o) { false; }
void resize(int expectedObjectCount) {
seen = new CompactIdentityHashSet(expectedObjectCount);
}
void incSize(long n) {
size += n;
onSizeChanged();
}
long recurse(O o) {
if (o == null) ret 0;
seen.add(o);
stack.add(o);
while ping (nempty(stack))
step(popLast(stack));
ret size;
}
void step(O o) {
if (guessDeepObjectSize_shouldIgnoreObject(o)) ret;
if (shouldIgnore(o)) ret;
onNewObject(o);
if (realmsToIgnore != null && contains(realmsToIgnore, getRealm(o))) ret;
ifdef RecursiveObjectSize_debug
print("gos: " + getClassName(o));
endifdef
if (o instanceof Class) ret;
incSize(unsafe_sizeOf(o));
if (o cast O[]) {
for (O x : o)
if (x != null && seen.add(x)) stack.add(x);
ret;
}
if (sizeCalculation_shouldSkipObject(o)) ret;
for (Field f : nonStaticNonPrimitiveFieldObjects(o)) {
if (contains(fieldsToIgnore, f)) continue;
if (skipTransientFields && isTransient(f)) continue;
O x;
try {
x = f.get(o);
} catch e {
print("Error trying to access " + f + ": " + e);
continue;
}
if (x != null && seen.add(x)) {
stack.add(x);
ifdef RecursiveObjectSize_debug
print("gos field " + f + ": " + getClassName(x));
endifdef
}
}
//fail("can't handle object type: " + className(o));
}
bool hasSeen(O o) {
ret seen.contains(o);
}
}