about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--043new.cc6
-rw-r--r--081run_interactive.cc17
2 files changed, 19 insertions, 4 deletions
diff --git a/043new.cc b/043new.cc
index a41f902f..42608264 100644
--- a/043new.cc
+++ b/043new.cc
@@ -118,7 +118,11 @@ case NEW: {
 
 :(code)
 void ensure_space(long long int size) {
-  assert(size <= Initial_memory_per_routine);
+  if (size > Initial_memory_per_routine) {
+    tb_shutdown();
+    cerr << "can't allocate " << size << " locations, that's too much.\n";
+    exit(0);
+  }
   if (Current_routine->alloc + size > Current_routine->alloc_max) {
     // waste the remaining space and create a new chunk
     Current_routine->alloc = Memory_allocated_until;
diff --git a/081run_interactive.cc b/081run_interactive.cc
index 67fba6e3..411b448a 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -303,9 +303,20 @@ long long int trace_contents(const string& layer) {
     out << p->contents;
     if (*--p->contents.end() != '\n') out << '\n';
   }
-  assert(!out.str().empty());
-//?   cerr << layer << ":\n" << out.str() << "\n--\n"; //? 1
-  return new_mu_string(out.str());
+  string result = out.str();
+  assert(!result.empty());
+//?   cerr << layer << ":\n" << result << "\n--\n"; //? 1
+  truncate(result);
+  return new_mu_string(result);
+}
+
+void truncate(string& x) {
+  if (SIZE(x) > 512) {
+    x.erase(512);
+    *x.rbegin() = '\n';
+    *++x.rbegin() = '.';
+    *++++x.rbegin() = '.';
+  }
 }
 
 //: simpler version of run-interactive: doesn't do any running, just loads