If you pass a primitive variable to the log method, Java will automatically convert it to the corresponding wrapper object, in a process called autoboxing. That's great if you don't care about garbage creation, which is not the case of MentaLog. To avoid this problem, MentaLog offers a StringBuilder pool that you can use to write the primitive value to a StringBuilder so that no autoboxing is necessary. Below is an example:
Warn.log("This is a number:", 11222); // creates garbage because of autoboxing Warn.log("This is a number:", to_sb(11222)); // garbage-free version
There is a static to_sb method for each primitive type that returns a StringBuilder with the value converted to a char sequence. Of course no garbate is created when the primitive value is formatted as a string.
Because the to_sb method uses a StringBuilder pool, you can use it for as many parameters as you want in your log methods.
If your log is non-synchronized, the to_sb method uses a single StringBuilder pool. If you log is synchronized, the to_sb method uses a different pool for each thread through a thread local.
Varargs also allocates a new object array for each method call. However MentaLog uses method overloading to fake varargs up to 16 arguments. As a result, as long as you don't log more than 16 arguments in a single call to the log method, no object array allocation will ever happen.