You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/11 07:20:24 UTC
[GitHub] [incubator-nuttx-apps] GUIDINGLI commented on a diff in pull request #1406: mm: add memory stress test
GUIDINGLI commented on code in PR #1406:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1406#discussion_r1019914920
##########
testing/mm/mm_main.c:
##########
@@ -310,6 +310,60 @@ static void do_frees(FAR void **mem, FAR const int *size,
}
}
+static int mm_stress_test(int argc, FAR char *argv[])
+{
+ FAR unsigned char *tmp;
+ int delay = 1;
+ int prio = 0;
+ int size;
+ int i;
+
+ while ((i = getopt(argc, argv, "d:p:")) != ERROR)
+ {
+ if (i == 'd')
+ {
+ delay = atoi(optarg);
+ }
+ else if (i == 'p')
+ {
+ prio = atoi(optarg);
+ }
+ else
+ {
+ printf("Unrecognized option: '%c'\n", i);
+ return -EINVAL;
+ }
+ }
+
+ if (prio != 0)
+ {
+ struct sched_param param;
+
+ sched_getparam(0, ¶m);
+ param.sched_priority = prio;
+ sched_setparam(0, ¶m);
+ }
+
+ while (1)
+ {
+ size = random() % 1024 + 1;
+ tmp = malloc(size);
+ assert(tmp);
+
+ memset(tmp, 0xfe, size);
+ usleep(delay);
+
+ for (i = 0; i < size; i++)
Review Comment:
memcmp may replace to the asm version. Than kasan can't insert check code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org