Warning: session_start(): open(/var/lib/php/sessions/sess_l7t3piqnbgnm5b5k1kf4h0k8ea, 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
sclass guessDeepObjectSize_recursive_Data {
long size;
new L stack;
Set seen = identityHashSet(); // add objects here to ignore them
Set fieldsToIgnore;
Set realmsToIgnore;
VF1 onNewObject;
}
static long guessDeepObjectSize_recursive(O o) {
if (o == null) ret 0;
ret guessDeepObjectSize_recursive(new guessDeepObjectSize_recursive_Data, o);
}
static long guessDeepObjectSize_recursive(guessDeepObjectSize_recursive_Data data, O o) {
if (o == null) ret 0;
data.stack.add(o);
while ping (nempty(data.stack)) {
/*ifdef guessDeepObjectSize_recursive_debug
print("gos stack size: " + l(data.stack));
endifdef*/
guessDeepObjectSize_recursive_step(data, popLast(data.stack));
}
ret data.size;
}
svoid guessDeepObjectSize_recursive_step(guessDeepObjectSize_recursive_Data data, O o) {
if (!data.seen.add(o)) ret;
if (o instanceof Component) ret; // skipping AWT for now
if (o instanceof Thread || o instanceof ThreadLocal) ret;
callF(data.onNewObject, o);
if (data.realmsToIgnore != null && contains(data.realmsToIgnore, getRealm(o))) ret;
ifdef guessDeepObjectSize_recursive_debug
print("gos: " + getClassName(o));
endifdef
if (o instanceof Class) ret;
if (isArray(o)) {
int len;
if (o instanceof O[]) {
// len is computed correctly by unsafe_sizeOf
len = unsafe_sizeOf(o);
for (O x : (O[]) o)
if (x != null && !data.seen.contains(x)) data.stack.add(x);
} else
len = inMemorySizeOfPrimitiveArray(o);
data.size += len;
ret;
}
data.size += unsafe_sizeOf(o);
if (sizeCalculation_shouldSkipObject(o)) ret;
for (Field f : nonStaticNonPrimitiveFieldObjects(o)) {
if (contains(data.fieldsToIgnore, f)) continue;
O x;
try {
x = f.get(o);
} catch e {
print("Error trying to access " + f + ": " + e);
continue;
}
if (x != null && !data.seen.contains(x)) {
data.stack.add(x);
ifdef guessDeepObjectSize_recursive_debug
print("gos field " + f + ": " + getClassName(x));
endifdef
}
}
//fail("can't handle object type: " + className(o));
}