diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.c
index 76374d16a5658e23dd3f8215f866f7418ef8ab34..fbd4986dfba12837bb086b546003a41683c32539 100644
--- a/test/core/end2end/tests/resource_quota_server.c
+++ b/test/core/end2end/tests/resource_quota_server.c
@@ -99,12 +99,16 @@ static void end_test(grpc_end2end_test_fixture *f) {
 static gpr_slice generate_random_slice() {
   size_t i;
   static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";
-  char output[1024 * 1024];
-  for (i = 0; i < GPR_ARRAY_SIZE(output) - 1; ++i) {
+  char *output;
+  const size_t output_size = 1024 * 1024;
+  output = gpr_malloc(output_size);
+  for (i = 0; i < output_size - 1; ++i) {
     output[i] = chars[rand() % (int)(sizeof(chars) - 1)];
   }
-  output[GPR_ARRAY_SIZE(output) - 1] = '\0';
-  return gpr_slice_from_copied_string(output);
+  output[output_size - 1] = '\0';
+  gpr_slice out = gpr_slice_from_copied_string(output);
+  gpr_free(output);
+  return out;
 }
 
 void resource_quota_server(grpc_end2end_test_config config) {