Debian Codegraph @

templates/man3/malloc_info.3.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:30+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "malloc_info"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-08"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid "malloc_info - export malloc state to a stream"
50 msgstr ""
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "LIBRARY"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
61 #: opensuse-leap-16-1 opensuse-tumbleweed
62 msgid "Standard C library (I<libc>,\\ I<-lc>)"
63 msgstr ""
64
65 #. type: SH
66 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
67 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
68 #, no-wrap
69 msgid "SYNOPSIS"
70 msgstr ""
71
72 #. type: Plain text
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 #, no-wrap
76 msgid "B<#include E<lt>malloc.hE<gt>>\n"
77 msgstr ""
78
79 #. type: Plain text
80 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
81 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
82 #, no-wrap
83 msgid "B<int malloc_info(int >I<options>B<, FILE *>I<stream>B<);>\n"
84 msgstr ""
85
86 #. type: SH
87 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
88 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
89 #, no-wrap
90 msgid "DESCRIPTION"
91 msgstr ""
92
93 #. type: Plain text
94 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
95 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
96 msgid ""
97 "The B<malloc_info>() function exports an XML string that describes the "
98 "current state of the memory-allocation implementation in the caller. The "
99 "string is printed on the file stream I<stream>. The exported string "
100 "includes information about all arenas (see B<malloc>(3))."
101 msgstr ""
102
103 #. type: Plain text
104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
106 msgid "As currently implemented, I<options> must be zero."
107 msgstr ""
108
109 #. type: SH
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 #, no-wrap
113 msgid "RETURN VALUE"
114 msgstr ""
115
116 #. type: Plain text
117 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
118 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
119 msgid ""
120 "On success, B<malloc_info>() returns 0. On failure, it returns -1, and "
121 "I<errno> is set to indicate the error."
122 msgstr ""
123
124 #. type: SH
125 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
126 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
127 #, no-wrap
128 msgid "ERRORS"
129 msgstr ""
130
131 #. type: TP
132 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
133 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
134 #, no-wrap
135 msgid "B<EINVAL>"
136 msgstr ""
137
138 #. type: Plain text
139 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
140 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
141 msgid "I<options> was nonzero."
142 msgstr ""
143
144 #. type: SH
145 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
146 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
147 #, no-wrap
148 msgid "ATTRIBUTES"
149 msgstr ""
150
151 #. type: Plain text
152 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
153 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
154 msgid ""
155 "For an explanation of the terms used in this section, see B<attributes>(7)."
156 msgstr ""
157
158 #. type: tbl table
159 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
160 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
161 #, no-wrap
162 msgid "Interface"
163 msgstr ""
164
165 #. type: tbl table
166 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
167 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
168 #, no-wrap
169 msgid "Attribute"
170 msgstr ""
171
172 #. type: tbl table
173 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
174 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
175 #, no-wrap
176 msgid "Value"
177 msgstr ""
178
179 #. type: tbl table
180 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
181 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
182 #, no-wrap
183 msgid ".na\n"
184 msgstr ""
185
186 #. type: tbl table
187 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
188 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
189 #, no-wrap
190 msgid ".nh\n"
191 msgstr ""
192
193 #. type: tbl table
194 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
195 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
196 #, no-wrap
197 msgid "B<malloc_info>()"
198 msgstr ""
199
200 #. type: tbl table
201 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
202 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
203 #, no-wrap
204 msgid "Thread safety"
205 msgstr ""
206
207 #. type: tbl table
208 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
209 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
210 #, no-wrap
211 msgid "MT-Safe"
212 msgstr ""
213
214 #. type: SH
215 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
216 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
217 #, no-wrap
218 msgid "STANDARDS"
219 msgstr ""
220
221 #. type: Plain text
222 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
223 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
224 msgid "GNU."
225 msgstr ""
226
227 #. type: SH
228 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
229 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
230 #, no-wrap
231 msgid "HISTORY"
232 msgstr ""
233
234 #. type: Plain text
235 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
236 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
237 msgid "glibc 2.10."
238 msgstr ""
239
240 #. type: SH
241 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
242 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
243 #, no-wrap
244 msgid "NOTES"
245 msgstr ""
246
247 #. type: Plain text
248 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
249 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
250 msgid ""
251 "The memory-allocation information is provided as an XML string (rather than "
252 "a C structure) because the information may change over time (according to "
253 "changes in the underlying implementation). The output XML string includes a "
254 "version field."
255 msgstr ""
256
257 #. type: Plain text
258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
260 msgid ""
261 "The B<open_memstream>(3) function can be used to send the output of "
262 "B<malloc_info>() directly into a buffer in memory, rather than to a file."
263 msgstr ""
264
265 #. type: Plain text
266 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
267 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
268 msgid ""
269 "The B<malloc_info>() function is designed to address deficiencies in "
270 "B<malloc_stats>(3) and B<mallinfo>(3)."
271 msgstr ""
272
273 #. type: SH
274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
276 #, no-wrap
277 msgid "EXAMPLES"
278 msgstr ""
279
280 #. type: Plain text
281 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
282 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
283 msgid ""
284 "The program below takes up to four command-line arguments, of which the "
285 "first three are mandatory. The first argument specifies the number of "
286 "threads that the program should create. All of the threads, including the "
287 "main thread, allocate the number of blocks of memory specified by the second "
288 "argument. The third argument controls the size of the blocks to be "
289 "allocated. The main thread creates blocks of this size, the second thread "
290 "created by the program allocates blocks of twice this size, the third thread "
291 "allocates blocks of three times this size, and so on."
292 msgstr ""
293
294 #. type: Plain text
295 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
296 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
297 msgid ""
298 "The program calls B<malloc_info>() twice to display the memory-allocation "
299 "state. The first call takes place before any threads are created or memory "
300 "allocated. The second call is performed after all threads have allocated "
301 "memory."
302 msgstr ""
303
304 #. type: Plain text
305 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
306 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
307 msgid ""
308 "In the following example, the command-line arguments specify the creation of "
309 "one additional thread, and both the main thread and the additional thread "
310 "allocate 10000 blocks of memory. After the blocks of memory have been "
311 "allocated, B<malloc_info>() shows the state of two allocation arenas."
312 msgstr ""
313
314 #. type: Plain text
315 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
316 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
317 #, no-wrap
318 msgid ""
319 "$ B<getconf GNU_LIBC_VERSION>\n"
320 "glibc 2.13\n"
321 "$ B<./a.out 1 10000 100>\n"
322 "============ Before allocating blocks ============\n"
323 "E<lt>malloc version=\"1\"E<gt>\n"
324 "E<lt>heap nr=\"0\"E<gt>\n"
325 "E<lt>sizesE<gt>\n"
326 "E<lt>/sizesE<gt>\n"
327 "E<lt>total type=\"fast\" count=\"0\" size=\"0\"/E<gt>\n"
328 "E<lt>total type=\"rest\" count=\"0\" size=\"0\"/E<gt>\n"
329 "E<lt>system type=\"current\" size=\"135168\"/E<gt>\n"
330 "E<lt>system type=\"max\" size=\"135168\"/E<gt>\n"
331 "E<lt>aspace type=\"total\" size=\"135168\"/E<gt>\n"
332 "E<lt>aspace type=\"mprotect\" size=\"135168\"/E<gt>\n"
333 "E<lt>/heapE<gt>\n"
334 "E<lt>total type=\"fast\" count=\"0\" size=\"0\"/E<gt>\n"
335 "E<lt>total type=\"rest\" count=\"0\" size=\"0\"/E<gt>\n"
336 "E<lt>system type=\"current\" size=\"135168\"/E<gt>\n"
337 "E<lt>system type=\"max\" size=\"135168\"/E<gt>\n"
338 "E<lt>aspace type=\"total\" size=\"135168\"/E<gt>\n"
339 "E<lt>aspace type=\"mprotect\" size=\"135168\"/E<gt>\n"
340 "E<lt>/mallocE<gt>\n"
341 "\\&\n"
342 "============ After allocating blocks ============\n"
343 "E<lt>malloc version=\"1\"E<gt>\n"
344 "E<lt>heap nr=\"0\"E<gt>\n"
345 "E<lt>sizesE<gt>\n"
346 "E<lt>/sizesE<gt>\n"
347 "E<lt>total type=\"fast\" count=\"0\" size=\"0\"/E<gt>\n"
348 "E<lt>total type=\"rest\" count=\"0\" size=\"0\"/E<gt>\n"
349 "E<lt>system type=\"current\" size=\"1081344\"/E<gt>\n"
350 "E<lt>system type=\"max\" size=\"1081344\"/E<gt>\n"
351 "E<lt>aspace type=\"total\" size=\"1081344\"/E<gt>\n"
352 "E<lt>aspace type=\"mprotect\" size=\"1081344\"/E<gt>\n"
353 "E<lt>/heapE<gt>\n"
354 "E<lt>heap nr=\"1\"E<gt>\n"
355 "E<lt>sizesE<gt>\n"
356 "E<lt>/sizesE<gt>\n"
357 "E<lt>total type=\"fast\" count=\"0\" size=\"0\"/E<gt>\n"
358 "E<lt>total type=\"rest\" count=\"0\" size=\"0\"/E<gt>\n"
359 "E<lt>system type=\"current\" size=\"1032192\"/E<gt>\n"
360 "E<lt>system type=\"max\" size=\"1032192\"/E<gt>\n"
361 "E<lt>aspace type=\"total\" size=\"1032192\"/E<gt>\n"
362 "E<lt>aspace type=\"mprotect\" size=\"1032192\"/E<gt>\n"
363 "E<lt>/heapE<gt>\n"
364 "E<lt>total type=\"fast\" count=\"0\" size=\"0\"/E<gt>\n"
365 "E<lt>total type=\"rest\" count=\"0\" size=\"0\"/E<gt>\n"
366 "E<lt>system type=\"current\" size=\"2113536\"/E<gt>\n"
367 "E<lt>system type=\"max\" size=\"2113536\"/E<gt>\n"
368 "E<lt>aspace type=\"total\" size=\"2113536\"/E<gt>\n"
369 "E<lt>aspace type=\"mprotect\" size=\"2113536\"/E<gt>\n"
370 "E<lt>/mallocE<gt>\n"
371 msgstr ""
372
373 #. type: SS
374 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
375 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
376 #, no-wrap
377 msgid "Program source"
378 msgstr ""
379
380 #. type: Plain text
381 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
382 #: opensuse-tumbleweed
383 #, no-wrap
384 msgid ""
385 "#include E<lt>err.hE<gt>\n"
386 "#include E<lt>errno.hE<gt>\n"
387 "#include E<lt>malloc.hE<gt>\n"
388 "#include E<lt>pthread.hE<gt>\n"
389 "#include E<lt>stdlib.hE<gt>\n"
390 "#include E<lt>unistd.hE<gt>\n"
391 "\\&\n"
392 "static size_t blockSize;\n"
393 "static size_t numThreads;\n"
394 "static unsigned int numBlocks;\n"
395 "\\&\n"
396 "static void *\n"
397 "thread_func(void *arg)\n"
398 "{\n"
399 " int tn = (int) arg;\n"
400 "\\&\n"
401 " /* The multiplier \\[aq](2 + tn)\\[aq] ensures that each thread (including\n"
402 " the main thread) allocates a different amount of memory. */\n"
403 "\\&\n"
404 " for (unsigned int j = 0; j E<lt> numBlocks; j++)\n"
405 " if (malloc(blockSize * (2 + tn)) == NULL)\n"
406 " err(EXIT_FAILURE, \"malloc-thread\");\n"
407 "\\&\n"
408 " sleep(100); /* Sleep until main thread terminates. */\n"
409 " return NULL;\n"
410 "}\n"
411 "\\&\n"
412 "int\n"
413 "main(int argc, char *argv[])\n"
414 "{\n"
415 " int sleepTime;\n"
416 " pthread_t *thr;\n"
417 "\\&\n"
418 " if (argc E<lt> 4) {\n"
419 " fprintf(stderr,\n"
420 " \"%s num-threads num-blocks block-size [sleep-time]\\[rs]n\",\n"
421 " argv[0]);\n"
422 " exit(EXIT_FAILURE);\n"
423 " }\n"
424 "\\&\n"
425 " numThreads = atoi(argv[1]);\n"
426 " numBlocks = atoi(argv[2]);\n"
427 " blockSize = atoi(argv[3]);\n"
428 " sleepTime = (argc E<gt> 4) ? atoi(argv[4]) : 0;\n"
429 "\\&\n"
430 " thr = calloc(numThreads, sizeof(*thr));\n"
431 " if (thr == NULL)\n"
432 " err(EXIT_FAILURE, \"calloc\");\n"
433 "\\&\n"
434 " printf(\"============ Before allocating blocks ============\\[rs]n\");\n"
435 " malloc_info(0, stdout);\n"
436 "\\&\n"
437 " /* Create threads that allocate different amounts of memory. */\n"
438 "\\&\n"
439 " for (size_t tn = 0; tn E<lt> numThreads; tn++) {\n"
440 " errno = pthread_create(&thr[tn], NULL, thread_func,\n"
441 " (void *) tn);\n"
442 " if (errno != 0)\n"
443 " err(EXIT_FAILURE, \"pthread_create\");\n"
444 "\\&\n"
445 " /* If we add a sleep interval after the start-up of each\n"
446 " thread, the threads likely won\\[aq]t contend for malloc\n"
447 " mutexes, and therefore additional arenas won\\[aq]t be\n"
448 " allocated (see malloc(3)). */\n"
449 "\\&\n"
450 " if (sleepTime E<gt> 0)\n"
451 " sleep(sleepTime);\n"
452 " }\n"
453 "\\&\n"
454 " /* The main thread also allocates some memory. */\n"
455 "\\&\n"
456 " for (unsigned int j = 0; j E<lt> numBlocks; j++)\n"
457 " if (malloc(blockSize) == NULL)\n"
458 " err(EXIT_FAILURE, \"malloc\");\n"
459 "\\&\n"
460 " sleep(2); /* Give all threads a chance to\n"
461 " complete allocations. */\n"
462 "\\&\n"
463 " printf(\"\\[rs]n============ After allocating blocks ============\\[rs]n\");\n"
464 " malloc_info(0, stdout);\n"
465 "\\&\n"
466 " exit(EXIT_SUCCESS);\n"
467 "}\n"
468 msgstr ""
469
470 #. SRC END
471 #. type: SH
472 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
473 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
474 #, no-wrap
475 msgid "SEE ALSO"
476 msgstr ""
477
478 #. type: Plain text
479 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
480 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
481 msgid ""
482 "B<mallinfo>(3), B<malloc>(3), B<malloc_stats>(3), B<mallopt>(3), "
483 "B<open_memstream>(3)"
484 msgstr ""
485
486 #. type: TH
487 #: debian-trixie
488 #, no-wrap
489 msgid "2024-06-15"
490 msgstr ""
491
492 #. type: TH
493 #: debian-trixie
494 #, no-wrap
495 msgid "Linux man-pages 6.9.1"
496 msgstr ""
497
498 #. type: Plain text
499 #: debian-trixie
500 msgid "Standard C library (I<libc>, I<-lc>)"
501 msgstr ""
502
503 #. type: Plain text
504 #: debian-trixie fedora-44 fedora-rawhide
505 #, no-wrap
506 msgid ""
507 "#include E<lt>err.hE<gt>\n"
508 "#include E<lt>errno.hE<gt>\n"
509 "#include E<lt>malloc.hE<gt>\n"
510 "#include E<lt>pthread.hE<gt>\n"
511 "#include E<lt>stdlib.hE<gt>\n"
512 "#include E<lt>unistd.hE<gt>\n"
513 "\\&\n"
514 "static size_t blockSize;\n"
515 "static size_t numThreads;\n"
516 "static unsigned int numBlocks;\n"
517 "\\&\n"
518 "static void *\n"
519 "thread_func(void *arg)\n"
520 "{\n"
521 " int tn = (int) arg;\n"
522 "\\&\n"
523 " /* The multiplier \\[aq](2 + tn)\\[aq] ensures that each thread (including\n"
524 " the main thread) allocates a different amount of memory. */\n"
525 "\\&\n"
526 " for (unsigned int j = 0; j E<lt> numBlocks; j++)\n"
527 " if (malloc(blockSize * (2 + tn)) == NULL)\n"
528 " err(EXIT_FAILURE, \"malloc-thread\");\n"
529 "\\&\n"
530 " sleep(100); /* Sleep until main thread terminates. */\n"
531 " return NULL;\n"
532 "}\n"
533 "\\&\n"
534 "int\n"
535 "main(int argc, char *argv[])\n"
536 "{\n"
537 " int sleepTime;\n"
538 " pthread_t *thr;\n"
539 "\\&\n"
540 " if (argc E<lt> 4) {\n"
541 " fprintf(stderr,\n"
542 " \"%s num-threads num-blocks block-size [sleep-time]\\[rs]n\",\n"
543 " argv[0]);\n"
544 " exit(EXIT_FAILURE);\n"
545 " }\n"
546 "\\&\n"
547 " numThreads = atoi(argv[1]);\n"
548 " numBlocks = atoi(argv[2]);\n"
549 " blockSize = atoi(argv[3]);\n"
550 " sleepTime = (argc E<gt> 4) ? atoi(argv[4]) : 0;\n"
551 "\\&\n"
552 " thr = calloc(numThreads, sizeof(*thr));\n"
553 " if (thr == NULL)\n"
554 " err(EXIT_FAILURE, \"calloc\");\n"
555 "\\&\n"
556 " printf(\"============ Before allocating blocks ============\\[rs]n\");\n"
557 " malloc_info(0, stdout);\n"
558 "\\&\n"
559 " /* Create threads that allocate different amounts of memory. */\n"
560 "\\&\n"
561 " for (size_t tn = 0; tn E<lt> numThreads; tn++) {\n"
562 " errno = pthread_create(&thr[tn], NULL, thread_func,\n"
563 " (void *) tn);\n"
564 " if (errno != 0)\n"
565 " err(EXIT_FAILURE, \"pthread_create\");\n"
566 "\\&\n"
567 " /* If we add a sleep interval after the start-up of each\n"
568 " thread, the threads likely won\\[aq]t contend for malloc\n"
569 " mutexes, and therefore additional arenas won\\[aq]t be\n"
570 " allocated (see malloc(3)). */\n"
571 "\\&\n"
572 " if (sleepTime E<gt> 0)\n"
573 " sleep(sleepTime);\n"
574 " }\n"
575 "\\&\n"
576 " /* The main thread also allocates some memory. */\n"
577 "\\&\n"
578 " for (unsigned int j = 0; j E<lt> numBlocks; j++)\n"
579 " if (malloc(blockSize) == NULL)\n"
580 " err(EXIT_FAILURE, \"malloc\");\n"
581 "\\&\n"
582 " sleep(2); /* Give all threads a chance to\n"
583 " complete allocations. */\n"
584 "\\&\n"
585 " printf(\"\\[rs]n============ After allocating blocks ============\\[rs]n\");\n"
586 " malloc_info(0, stdout);\n"
587 "\\&\n"
588 " exit(EXIT_SUCCESS);\n"
589 "}\n"
590 msgstr ""
591
592 #. type: TH
593 #: fedora-44 fedora-rawhide
594 #, no-wrap
595 msgid "2024-07-23"
596 msgstr ""
597
598 #. type: TH
599 #: fedora-44 fedora-rawhide
600 #, no-wrap
601 msgid "Linux man-pages 6.13"
602 msgstr ""
603
604 #. type: TH
605 #: mageia-cauldron
606 #, no-wrap
607 msgid "Linux man-pages 6.17"
608 msgstr ""
609
610 #. type: TH
611 #: opensuse-leap-16-1 opensuse-tumbleweed
612 #, no-wrap
613 msgid "Linux man-pages (unreleased)"
614 msgstr ""