This is an example of how you can find large objects that you’re trying to save. Just add the bold code below and save a drawing. Change the threshold for your own needs.
package cm.io.object;
In RobustPutEnv2 class:
/** * Put Object. */ final public bool putObject(Object z) { if (!z) { bug; } else if (z in visited) { // done return false; } else { int prevPos = summarySizes ? b.pos() : 0; if (false and staffan) { static int _n = 0; if (_n == 0) ptrace("BEGIN SLOW SAVE".eAngry); if (_n++ % 10 == 0) sleep(20); } // object magic putMagic(0x0bae); Object prevOwner = currentOwner; currentOwner = z; b.reserveBackpatchSize(); int start = b.pos(); visited << z; requiredPkgs << z.class.pkg; if (summaryCounts) increaseSummaryCount(z.class); if (z as Collection) { putCollection(z); } else if (z as Definition) { b.putByte(streamType.runtimeDefinition); putDefinition(z); } else if (z as EnumEntry) { b.putByte(streamType.runtimeEnumEntry); putEnumEntry(z); } else if (z.class in unstreamable) { throw IoException(format("unstreamable class '@z.class;'")); } else { putObjHeader(z); if (!putWrappedObj(z)) { putObjFields(z); formatter.saving++; z.save(formatter); formatter.saving--; dispatchCount++; } } currentOwner = prevOwner; b.backpatchSize(); if (b.pos - start > 100000) pln(" BIG OBJECT SAVED ", z, " Size = ", (b.pos - start)); if (summarySizes) increaseSummarySize(z.class, (b.pos - prevPos)); return true; } }
Result (if you have an object that big)
BIG OBJECT SAVED MixedMaterial3D(0x2541bb58) Size = 4962549 BIG OBJECT SAVED WrappedImageMaterial3D(0x2541c1b0) Size = 4962569
Comments
0 comments
Please sign in to leave a comment.