It's tough to reliably reproduce, but I often get stack imbalance warnings
when calling max.col() on non-real/double matrix. The code is conditionally
PROTECTing but not incrementing its nprot counter for the eventual
UNPROTECT. Pretty sure this would fix (but I haven't tested it):

Index: array.c
===================================================================
--- array.c    (revision 61606)
+++ array.c    (working copy)
@@ -1614,7 +1614,10 @@
     SEXP m = CAR(args);
     int method = asInteger(CADR(args));
     int nr = nrows(m), nc = ncols(m), nprot = 1;
-    if (TYPEOF(m) != REALSXP) PROTECT(m = coerceVector(m, REALSXP));
+    if (TYPEOF(m) != REALSXP) {
+      PROTECT(m = coerceVector(m, REALSXP));
+      nprot++;
+    }
     SEXP ans = allocVector(INTSXP, nr);
     PROTECT(ans);
     R_max_col(REAL(m), &nr, &nc, INTEGER(ans), &method);

Thanks,
Michael

	[[alternative HTML version deleted]]

