Debian Codegraph @

po/pt_BR/man3/malloc.3.po

raw
1 # Brazilian Portuguese translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # E. A. Tacão <[email protected]>, 2001.
5 # André Luiz Fassone <[email protected]>, 2001.
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: manpages-l10n\n"
9 "POT-Creation-Date: 2026-06-05 06:30+0200\n"
10 "PO-Revision-Date: 2001-05-31 17:26+0200\n"
11 "Last-Translator: André Luiz Fassone <[email protected]>\n"
12 "Language-Team: Brazilian Portuguese <debian-l10n-"
13 "[email protected]>\n"
14 "Language: pt_BR\n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
19 "X-Generator: Lokalize 20.04.1\n"
20
21 #. type: TH
22 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
23 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
24 #, fuzzy, no-wrap
25 #| msgid "B<reallocarray>():"
26 msgid "malloc"
27 msgstr "B<reallocarray>():"
28
29 #. type: TH
30 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
31 #: opensuse-tumbleweed
32 #, no-wrap
33 msgid "2026-02-08"
34 msgstr "8 fevereiro 2026"
35
36 #. type: TH
37 #: archlinux debian-unstable
38 #, fuzzy, no-wrap
39 #| msgid "Linux man-pages 6.17"
40 msgid "Linux man-pages 6.18"
41 msgstr "Linux man-pages 6.17"
42
43 #. type: SH
44 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
45 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
46 #, no-wrap
47 msgid "NAME"
48 msgstr "NOME"
49
50 #. type: Plain text
51 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
52 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
53 msgid ""
54 "malloc, free, calloc, realloc, reallocarray - allocate and free dynamic "
55 "memory"
56 msgstr ""
57 "malloc, free, calloc, realloc, reallocarray - alocam e liberam memória "
58 "dinâmica"
59
60 #. type: SH
61 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
62 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
63 #, no-wrap
64 msgid "LIBRARY"
65 msgstr "BIBLIOTECA"
66
67 #. type: Plain text
68 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
69 #: opensuse-leap-16-1 opensuse-tumbleweed
70 msgid "Standard C library (I<libc>,\\ I<-lc>)"
71 msgstr "Biblioteca C Padrão (I<libc>,\\ I<-lc>)"
72
73 #. type: SH
74 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
75 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
76 #, no-wrap
77 msgid "SYNOPSIS"
78 msgstr "SINOPSE"
79
80 #. type: Plain text
81 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
82 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
83 #, no-wrap
84 msgid "B<#include E<lt>stdlib.hE<gt>>\n"
85 msgstr "B<#include E<lt>stdlib.hE<gt>>\n"
86
87 #. type: Plain text
88 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
89 #: opensuse-tumbleweed
90 #, fuzzy, no-wrap
91 #| msgid ""
92 #| "B<void *malloc(size_t >I<size>B<);>\n"
93 #| "B<void free(void >I<*ptr>B<);>\n"
94 #| "B<void *calloc(size_t >I<nmemb>B<, size_t >I<size>B<);>\n"
95 #| "B<void *realloc(void >I<*ptr>B<, size_t >I<size>B<);>\n"
96 #| "B<void *reallocarray(void >I<*ptr>B<, size_t >I<nmemb>B<, size_t >I<size>B<);>\n"
97 msgid ""
98 "B<void *malloc(size_t >I<size>B<);>\n"
99 "B<void free(void *_Nullable >I<p>B<);>\n"
100 "B<void *calloc(size_t >I<n>B<, size_t >I<size>B<);>\n"
101 "B<void *realloc(void *_Nullable >I<p>B<, size_t >I<size>B<);>\n"
102 "B<void *reallocarray(void *_Nullable >I<p>B<, size_t >I<n>B<, size_t >I<size>B<);>\n"
103 msgstr ""
104 "B<void *malloc(size_t >I<tamanho>B<);>\n"
105 "B<void free(void >I<*ptr>B<);>\n"
106 "B<void *calloc(size_t >I<nmemb>B<, size_t >I<tamanho>B<);>\n"
107 "B<void *realloc(void >I<*ptr>B<, size_t >I<tamanho>B<);>\n"
108 "B<void *reallocarray(void >I<*ptr>B<, size_t >I<nmemb>B<, size_t >I<tamanho>B<);>\n"
109
110 #. type: Plain text
111 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
112 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
113 msgid ""
114 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
115 msgstr ""
116 "Requisitos de macro de teste de recursos para o glibc (consulte "
117 "B<feature_test_macros>(7)):"
118
119 #. type: Plain text
120 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
121 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
122 msgid "B<reallocarray>():"
123 msgstr "B<reallocarray>():"
124
125 #. type: Plain text
126 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
127 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
128 #, fuzzy, no-wrap
129 #| msgid ""
130 #| " Since glibc 2.19:\n"
131 #| " _DEFAULT_SOURCE\n"
132 #| " Glibc 2.19 and earlier:\n"
133 #| " _SVID_SOURCE\n"
134 msgid ""
135 " Since glibc 2.29:\n"
136 " _DEFAULT_SOURCE\n"
137 " glibc 2.28 and earlier:\n"
138 " _GNU_SOURCE\n"
139 msgstr ""
140 " Desde o glibc 2.19:\n"
141 " _DEFAULT_SOURCE\n"
142 " Glibc 2.19 e anterior:\n"
143 " _SVID_SOURCE\n"
144
145 #. type: SH
146 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
147 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
148 #, no-wrap
149 msgid "DESCRIPTION"
150 msgstr "DESCRIÇÃO"
151
152 #. type: SS
153 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
154 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
155 #, no-wrap
156 msgid "malloc()"
157 msgstr ""
158
159 #. type: Plain text
160 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
161 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
162 msgid ""
163 "The B<malloc>() function allocates I<size> bytes and returns a pointer to "
164 "the allocated memory. I<The memory is not initialized>. If I<size> is 0, "
165 "then B<malloc>() returns a unique pointer value that can later be "
166 "successfully passed to B<free>(). (See \"Nonportable behavior\" for "
167 "portability issues.)"
168 msgstr ""
169
170 #. type: SS
171 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
172 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
173 #, no-wrap
174 msgid "free()"
175 msgstr ""
176
177 #. type: Plain text
178 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
179 #: opensuse-tumbleweed
180 #, fuzzy
181 #| msgid ""
182 #| "B<free()> frees the memory space pointed to by I<ptr>, which must have "
183 #| "been returned by a previous call to B<malloc()>, B<calloc()> or "
184 #| "B<realloc()>. Otherwise, or if B<free(>I<ptr>B<)> has already been "
185 #| "called before, undefined behaviour occurs. If I<ptr> is B<NULL>, no "
186 #| "operation is performed."
187 msgid ""
188 "The B<free>() function frees the memory space pointed to by I<p>, which "
189 "must have been returned by a previous call to B<malloc>() or related "
190 "functions. Otherwise, or if I<p> has already been freed, undefined behavior "
191 "occurs. If I<p> is NULL, no operation is performed."
192 msgstr ""
193 "B<free()> libera o espaço de memória apontado por I<ptr>, o qual precisa ter "
194 "sido retornado por uma chamada anterior para B<malloc()>, B<calloc()> ou "
195 "B<realloc()>. Caso contrário, ou se B<free(>I<ptr>B<)> já tenha sido chamada "
196 "antes, um comportamento indefinido ocorre. Se I<ptr> for B<NULO>, nenhuma "
197 "operação será executada."
198
199 #. type: SS
200 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
201 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
202 #, no-wrap
203 msgid "calloc()"
204 msgstr ""
205
206 #. type: Plain text
207 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
208 #: opensuse-leap-16-1 opensuse-tumbleweed
209 msgid ""
210 "The B<calloc>() function allocates memory for an array of I<n> elements of "
211 "I<size> bytes each and returns a pointer to the allocated memory. The "
212 "memory is set to zero. If I<n> or I<size> is 0, then B<calloc>() returns a "
213 "unique pointer value that can later be successfully passed to B<free>()."
214 msgstr ""
215
216 #. type: Plain text
217 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
218 #: opensuse-leap-16-1 opensuse-tumbleweed
219 msgid ""
220 "If the multiplication of I<n> and I<size> would result in integer overflow, "
221 "then B<calloc>() returns an error. By contrast, an integer overflow would "
222 "not be detected in the following call to B<malloc>(), with the result that "
223 "an incorrectly sized block of memory would be allocated:"
224 msgstr ""
225
226 #. type: Plain text
227 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
228 #: opensuse-leap-16-1 opensuse-tumbleweed
229 #, no-wrap
230 msgid "malloc(n * size);\n"
231 msgstr ""
232
233 #. type: SS
234 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
235 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
236 #, fuzzy, no-wrap
237 #| msgid "B<reallocarray>():"
238 msgid "realloc()"
239 msgstr "B<reallocarray>():"
240
241 #. type: Plain text
242 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
243 #: opensuse-tumbleweed
244 #, fuzzy
245 #| msgid ""
246 #| "B<realloc()> changes the size of the memory block pointed to by I<ptr> to "
247 #| "I<size> bytes. The contents will be unchanged to the minimum of the old "
248 #| "and new sizes; newly allocated memory will be uninitialized. If I<ptr> "
249 #| "is B<NULL>, the call is equivalent to B<malloc(size)>; if size is equal "
250 #| "to zero, the call is equivalent to B<free(>I<ptr>B<)>I<.> Unless I<ptr> "
251 #| "is B<NULL>, it must have been returned by an earlier call to B<malloc()>, "
252 #| "B<calloc()> or B<realloc()>."
253 msgid ""
254 "The B<realloc>() function changes the size of the memory block pointed to "
255 "by I<p> to I<size> bytes. The contents of the memory will be unchanged in "
256 "the range from the start of the region up to the minimum of the old and new "
257 "sizes. If the new size is larger than the old size, the added memory will "
258 "I<not> be initialized."
259 msgstr ""
260 "B<realloc()> altera o tamanho do bloco de memória apontado por I<ptr> para "
261 "I<tamanho> bytes. O conteúdo não será alterado para o mínimo dos tamanhos "
262 "antigo e novo; a memória recém-alocada não será inicializada. Se I<ptr> for "
263 "B<NULO>, a chamada será equivalente a B<malloc(tamanho)>; se o tamanho for "
264 "igual a zero, a chamada será equivalente a B<free(>I<ptr>B<)>I<.> A menos "
265 "que I<ptr> seja B<NULO>, ele precisa ter sido retornado por uma chamada "
266 "anterior para to B<malloc()>, B<calloc()> ou B<realloc()>."
267
268 #. type: Plain text
269 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
270 #: opensuse-tumbleweed
271 msgid ""
272 "If I<p> is NULL, then the call is equivalent to I<malloc(size)>, for all "
273 "values of I<size>."
274 msgstr ""
275
276 #. type: Plain text
277 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
278 #: opensuse-tumbleweed
279 msgid ""
280 "If I<size> is equal to zero, and I<p> is not NULL, then the call is "
281 "equivalent to I<free(p)> (but see \"Nonportable behavior\" for portability "
282 "issues)."
283 msgstr ""
284
285 #. type: Plain text
286 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
287 #: opensuse-tumbleweed
288 msgid ""
289 "Unless I<p> is NULL, it must have been returned by an earlier call to "
290 "B<malloc> or related functions. If the area pointed to was moved, a "
291 "I<free(p)> is done."
292 msgstr ""
293
294 #. type: SS
295 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
296 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
297 #, fuzzy, no-wrap
298 #| msgid "B<reallocarray>():"
299 msgid "reallocarray()"
300 msgstr "B<reallocarray>():"
301
302 #. type: Plain text
303 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
304 #: opensuse-tumbleweed
305 msgid ""
306 "The B<reallocarray>() function changes the size of (and possibly moves) "
307 "the memory block pointed to by I<p> to be large enough for an array of I<n> "
308 "elements, each of which is I<size> bytes. It is equivalent to the call"
309 msgstr ""
310
311 #. type: Plain text
312 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
313 #: opensuse-tumbleweed
314 #, no-wrap
315 msgid "realloc(p, n * size);\n"
316 msgstr ""
317
318 #. type: Plain text
319 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
320 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
321 msgid ""
322 "However, unlike that B<realloc>() call, B<reallocarray>() fails safely in "
323 "the case where the multiplication would overflow. If such an overflow "
324 "occurs, B<reallocarray>() returns an error."
325 msgstr ""
326
327 #. type: SH
328 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
329 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
330 #, no-wrap
331 msgid "RETURN VALUE"
332 msgstr "VALOR DE RETORNO"
333
334 #. type: Plain text
335 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
336 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
337 msgid ""
338 "The B<malloc>(), B<calloc>(), B<realloc>(), and B<reallocarray>() functions "
339 "return a pointer to the allocated memory, which is suitably aligned for any "
340 "type that fits into the requested size or less. On error, these functions "
341 "return NULL and set I<errno>. Attempting to allocate more than "
342 "B<PTRDIFF_MAX> bytes is considered an error, as an object that large could "
343 "cause later pointer subtraction to overflow."
344 msgstr ""
345
346 #. type: Plain text
347 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
348 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
349 #, fuzzy
350 #| msgid "The B<free>() function returns no value."
351 msgid "The B<free>() function returns no value, and preserves I<errno>."
352 msgstr "A função B<free>() não retorna nada."
353
354 #. type: Plain text
355 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
356 #: opensuse-tumbleweed
357 #, fuzzy
358 #| msgid ""
359 #| "B<realloc()> returns a pointer to the newly allocated memory, which is "
360 #| "suitably aligned for any kind of variable and may be different from "
361 #| "I<ptr>, or B<NULL> if the request fails or if size was equal to 0. If "
362 #| "B<realloc()> fails the original block is left untouched - it is not freed "
363 #| "or moved."
364 msgid ""
365 "The B<realloc>() and B<reallocarray>() functions return NULL if I<p> is "
366 "not NULL and the requested size is zero; this is not considered an error. "
367 "(See \"Nonportable behavior\" for portability issues.) Otherwise, the "
368 "returned pointer may be the same as I<p> if the allocation was not moved "
369 "(e.g., there was room to expand the allocation in-place), or different from "
370 "I<p> if the allocation was moved to a new address. If these functions fail, "
371 "the original block is left untouched; it is not freed or moved."
372 msgstr ""
373 "B<realloc()> devolve um ponteiro à memória alocada, a qual é adequadamente "
374 "alinhada para qualquer tipo de variável e pode ser diferente de I<ptr>, ou "
375 "B<NULO> se o pedido falhar ou se o tamanho for igual a 0. Se B<realloc()> "
376 "falhar, o bloco original não é alterado - ele não é liberado nem movido."
377
378 #. type: SH
379 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
380 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
381 #, no-wrap
382 msgid "ERRORS"
383 msgstr "ERROS"
384
385 #. type: Plain text
386 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
387 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
388 msgid ""
389 "B<calloc>(), B<malloc>(), B<realloc>(), and B<reallocarray>() can fail with "
390 "the following error:"
391 msgstr ""
392
393 #. type: TP
394 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
395 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
396 #, no-wrap
397 msgid "B<ENOMEM>"
398 msgstr "B<ENOMEM>"
399
400 #. type: Plain text
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 msgid ""
404 "Out of memory. Possibly, the application hit the B<RLIMIT_AS> or "
405 "B<RLIMIT_DATA> limit described in B<getrlimit>(2). Another reason could be "
406 "that the number of mappings created by the caller process exceeded the limit "
407 "specified by I</proc/sys/vm/max_map_count>."
408 msgstr ""
409
410 #. type: SH
411 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
412 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
413 #, no-wrap
414 msgid "ATTRIBUTES"
415 msgstr "ATRIBUTOS"
416
417 #. type: Plain text
418 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
419 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
420 msgid ""
421 "For an explanation of the terms used in this section, see B<attributes>(7)."
422 msgstr ""
423 "Para uma explicação dos termos usados nesta seção, consulte B<attributes>(7)."
424
425 #. type: tbl table
426 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
427 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
428 #, no-wrap
429 msgid "Interface"
430 msgstr "Interface"
431
432 #. type: tbl table
433 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
434 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
435 #, no-wrap
436 msgid "Attribute"
437 msgstr "Atributo"
438
439 #. type: tbl table
440 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
441 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
442 #, no-wrap
443 msgid "Value"
444 msgstr "Valor"
445
446 #. type: tbl table
447 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
448 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
449 #, no-wrap
450 msgid ".na\n"
451 msgstr ".na\n"
452
453 #. type: tbl table
454 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
455 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
456 #, no-wrap
457 msgid ".nh\n"
458 msgstr ".nh\n"
459
460 #. type: tbl table
461 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
462 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
463 #, fuzzy, no-wrap
464 #| msgid ""
465 #| "B<calloc>(),\n"
466 #| "B<realloc>()"
467 msgid ""
468 "B<malloc>(),\n"
469 "B<free>(),\n"
470 "B<calloc>(),\n"
471 "B<realloc>()"
472 msgstr ""
473 "B<calloc>(),\n"
474 "B<realloc>()"
475
476 #. type: tbl table
477 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
478 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
479 #, no-wrap
480 msgid "Thread safety"
481 msgstr "Thread safety"
482
483 #. type: tbl table
484 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
485 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
486 #, no-wrap
487 msgid "MT-Safe"
488 msgstr "MT-Safe"
489
490 #. type: SH
491 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
492 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
493 #, no-wrap
494 msgid "STANDARDS"
495 msgstr "PADRÕES"
496
497 #. type: TP
498 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
499 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
500 #, fuzzy, no-wrap
501 #| msgid "B<reallocarray>():"
502 msgid "B<malloc>()"
503 msgstr "B<reallocarray>():"
504
505 #. type: TQ
506 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
507 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
508 #, no-wrap
509 msgid "B<free>()"
510 msgstr ""
511
512 #. type: TQ
513 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
514 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
515 #, fuzzy, no-wrap
516 #| msgid "B<syscall>(2)"
517 msgid "B<calloc>()"
518 msgstr "B<syscall>(2)"
519
520 #. type: TQ
521 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
522 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
523 #, fuzzy, no-wrap
524 #| msgid "B<reallocarray>():"
525 msgid "B<realloc>()"
526 msgstr "B<reallocarray>():"
527
528 #. type: Plain text
529 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
530 #: opensuse-tumbleweed
531 msgid "C23, POSIX.1-2024."
532 msgstr "C23, POSIX.1-2024."
533
534 #. type: TP
535 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
536 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
537 #, fuzzy, no-wrap
538 #| msgid "B<reallocarray>():"
539 msgid "B<reallocarray>()"
540 msgstr "B<reallocarray>():"
541
542 #. type: Plain text
543 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
544 #: opensuse-tumbleweed
545 msgid "POSIX.1-2024."
546 msgstr "POSIX.1-2024."
547
548 #. type: SS
549 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
550 #: opensuse-tumbleweed
551 #, fuzzy, no-wrap
552 #| msgid "B<reallocarray>():"
553 msgid "realloc(p, 0)"
554 msgstr "B<reallocarray>():"
555
556 #. type: Plain text
557 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
558 #: opensuse-tumbleweed
559 msgid ""
560 "The behavior of I<realloc(p,\\ 0)> in glibc doesn't conform to any of C99, "
561 "C11, POSIX.1-2001, POSIX.1-2004, POSIX.1-2008, POSIX.1-2013, POSIX.1-2017, "
562 "or POSIX.1-2024. The C17 specification was changed to make it conforming, "
563 "but that specification made it impossible to write code that reliably "
564 "determines if the input pointer is freed after I<realloc(p,\\ 0)>, and C23 "
565 "changed it again to make this undefined behavior, acknowledging that the C17 "
566 "specification was broad enough, so that undefined behavior wasn't worse than "
567 "that."
568 msgstr ""
569
570 #. type: Plain text
571 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
572 #: opensuse-tumbleweed
573 msgid "B<reallocarray>() suffers the same issues in glibc."
574 msgstr ""
575
576 #. type: Plain text
577 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
578 #: opensuse-tumbleweed
579 msgid "musl libc and the BSDs conform to all versions of ISO C and POSIX.1."
580 msgstr ""
581
582 #. type: Plain text
583 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
584 #: opensuse-tumbleweed
585 msgid ""
586 "gnulib provides the I<realloc-posix> module, which provides wrappers "
587 "B<realloc>() and B<reallocarray>() that conform to all versions of ISO C "
588 "and POSIX.1."
589 msgstr ""
590
591 #. type: Plain text
592 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
593 #: opensuse-tumbleweed
594 msgid ""
595 "There's a proposal to standardize the BSD behavior: E<.UR https:\\://"
596 "www.open-std.org/\\:jtc1/\\:sc22/\\:wg14/\\:www/\\:docs/\\:n3621.txt> "
597 "E<.UE .>"
598 msgstr ""
599
600 #. type: SH
601 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
602 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
603 #, no-wrap
604 msgid "HISTORY"
605 msgstr "HISTÓRICO"
606
607 #. type: Plain text
608 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
609 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
610 msgid "POSIX.1-2001, C89."
611 msgstr "POSIX.1-2001, C89."
612
613 #. type: Plain text
614 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
615 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
616 msgid "glibc 2.26. OpenBSD 5.6, FreeBSD 11.0."
617 msgstr ""
618
619 #. type: Plain text
620 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
621 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
622 msgid ""
623 "B<malloc>() and related functions rejected sizes greater than "
624 "B<PTRDIFF_MAX> starting in glibc 2.30."
625 msgstr ""
626
627 #. type: Plain text
628 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
629 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
630 msgid "B<free>() preserved I<errno> starting in glibc 2.33."
631 msgstr ""
632
633 #. type: SS
634 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
635 #: opensuse-tumbleweed
636 #, fuzzy, no-wrap
637 #| msgid "B<reallocarray>():"
638 msgid "realloc(p,\\ 0)"
639 msgstr "B<reallocarray>():"
640
641 #. type: Plain text
642 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
643 #: opensuse-tumbleweed
644 msgid ""
645 "C89 was ambiguous in its specification of I<realloc(p,\\ 0)>. C99 partially "
646 "fixed this."
647 msgstr ""
648
649 #. type: Plain text
650 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
651 #: opensuse-tumbleweed
652 msgid ""
653 "The original implementation in glibc would have been conforming to C99. "
654 "However, and ironically, trying to comply with C99 before the standard was "
655 "released, glibc changed its behavior in glibc 2.1.1 into something that "
656 "ended up not conforming to the final C99 specification (but this is debated, "
657 "as the wording of the standard seems self-contradicting)."
658 msgstr ""
659
660 #. type: SH
661 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
662 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
663 #, no-wrap
664 msgid "NOTES"
665 msgstr "NOTAS"
666
667 #. type: Plain text
668 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
669 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
670 #, fuzzy
671 #| msgid ""
672 #| "Linux follows an optimistic memory allocation strategy. This means that "
673 #| "when B<malloc()> returns non-NULL there is no guarantee that the memory "
674 #| "really is available. In case it turns out that the system is out of "
675 #| "memory, one or more processes will be killed by the infamous OOM killer."
676 msgid ""
677 "By default, Linux follows an optimistic memory allocation strategy. This "
678 "means that when B<malloc>() returns non-NULL there is no guarantee that the "
679 "memory really is available. In case it turns out that the system is out of "
680 "memory, one or more processes will be killed by the OOM killer. For more "
681 "information, see the description of I</proc/sys/vm/overcommit_memory> and I</"
682 "proc/sys/vm/oom_adj> in B<proc>(5), and the Linux kernel source file "
683 "I<Documentation/vm/overcommit-accounting.rst>."
684 msgstr ""
685 "O Linux segue uma estratégia otimista de alocação de memória. Isso significa "
686 "que, quando B<malloc()> retorna valores diferentes de NULO não há garantia "
687 "de que a memória realmente seja disponibilizada. No caso de o sistema ficar "
688 "sem memória, um ou mais processos serão destruídos pelo infame matador OOM "
689 "killer."
690
691 #. type: Plain text
692 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
693 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
694 msgid ""
695 "Normally, B<malloc>() allocates memory from the heap, and adjusts the size "
696 "of the heap as required, using B<sbrk>(2). When allocating blocks of memory "
697 "larger than B<MMAP_THRESHOLD> bytes, the glibc B<malloc>() implementation "
698 "allocates the memory as a private anonymous mapping using B<mmap>(2). "
699 "B<MMAP_THRESHOLD> is 128\\ kB by default, but is adjustable using "
700 "B<mallopt>(3). Prior to Linux 4.7 allocations performed using B<mmap>(2) "
701 "were unaffected by the B<RLIMIT_DATA> resource limit; since Linux 4.7, this "
702 "limit is also enforced for allocations performed using B<mmap>(2)."
703 msgstr ""
704
705 #. type: Plain text
706 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
707 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
708 msgid ""
709 "To avoid corruption in multithreaded applications, mutexes are used "
710 "internally to protect the memory-management data structures employed by "
711 "these functions. In a multithreaded application in which threads "
712 "simultaneously allocate and free memory, there could be contention for these "
713 "mutexes. To scalably handle memory allocation in multithreaded "
714 "applications, glibc creates additional I<memory allocation arenas> if mutex "
715 "contention is detected. Each arena is a large region of memory that is "
716 "internally allocated by the system (using B<brk>(2) or B<mmap>(2)), and "
717 "managed with its own mutexes."
718 msgstr ""
719
720 #. type: Plain text
721 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
722 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
723 msgid ""
724 "If your program uses a private memory allocator, it should do so by "
725 "replacing B<malloc>(), B<free>(), B<calloc>(), and B<realloc>(). The "
726 "replacement functions must implement the documented glibc behaviors, "
727 "including I<errno> handling, size-zero allocations, and overflow checking; "
728 "otherwise, other library routines may crash or operate incorrectly. For "
729 "example, if the replacement I<free>() does not preserve I<errno>, then "
730 "seemingly unrelated library routines may fail without having a valid reason "
731 "in I<errno>. Private memory allocators may also need to replace other glibc "
732 "functions; see \"Replacing malloc\" in the glibc manual for details."
733 msgstr ""
734
735 #. type: Plain text
736 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
737 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
738 #, fuzzy
739 #| msgid ""
740 #| "Crashes in B<malloc>(), B<calloc>(), B<realloc>(), or B<free>() are "
741 #| "almost always related to heap corruption, such as overflowing an "
742 #| "allocated chunk or freeing the same pointer twice."
743 msgid ""
744 "Crashes in memory allocators are almost always related to heap corruption, "
745 "such as overflowing an allocated chunk or freeing the same pointer twice."
746 msgstr ""
747 "Problemas em B<malloc>(), B<calloc>(), B<realloc>() ou B<free>() quase "
748 "sempre são relacionados a corrupção de 'heap', como estouro de capacidade "
749 "(\"overflowing\"), alocações ilegais (\"allocated chunk\") ou a liberação "
750 "duas vezes de um mesmo ponteiro."
751
752 #. type: Plain text
753 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
754 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
755 msgid ""
756 "The B<malloc>() implementation is tunable via environment variables; see "
757 "B<mallopt>(3) for details."
758 msgstr ""
759
760 #. type: SS
761 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
762 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
763 #, no-wrap
764 msgid "Nonportable behavior"
765 msgstr ""
766
767 #. type: Plain text
768 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
769 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
770 msgid ""
771 "The behavior of these functions when the requested size is zero is glibc "
772 "specific; other implementations may return NULL without setting I<errno>, "
773 "and portable POSIX programs should tolerate such behavior. See "
774 "B<realloc>(3p)."
775 msgstr ""
776
777 #. type: Plain text
778 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
779 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
780 msgid ""
781 "POSIX requires memory allocators to set I<errno> upon failure. However, the "
782 "C standard does not require this, and applications portable to non-POSIX "
783 "platforms should not assume this."
784 msgstr ""
785
786 #. type: Plain text
787 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
788 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
789 msgid ""
790 "Portable programs should not use private memory allocators, as POSIX and the "
791 "C standard do not allow replacement of B<malloc>(), B<free>(), B<calloc>(), "
792 "and B<realloc>()."
793 msgstr ""
794
795 #. type: SH
796 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
797 #: opensuse-tumbleweed
798 #, no-wrap
799 msgid "BUGS"
800 msgstr "BUGS"
801
802 #. type: Plain text
803 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
804 #: opensuse-tumbleweed
805 msgid ""
806 "Programmers would naturally expect by induction that I<\\%realloc(p,\\ "
807 "size)> is consistent with I<free(p)> and I<malloc(size)>, as that is the "
808 "behavior in the general case. This is not explicitly required by "
809 "POSIX.1-2024 or C11, but all conforming implementations are consistent with "
810 "that."
811 msgstr ""
812
813 #. type: Plain text
814 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
815 #: opensuse-tumbleweed
816 msgid ""
817 "The glibc implementation of B<realloc>() is not consistent with that, and "
818 "as a consequence, it is dangerous to call I<\\%realloc(p,\\ 0)> in glibc."
819 msgstr ""
820
821 #. type: Plain text
822 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
823 #: opensuse-tumbleweed
824 msgid ""
825 "A trivial workaround for glibc is calling it as I<\\%realloc(p,\\ size?"
826 "size:1)>."
827 msgstr ""
828
829 #. type: Plain text
830 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
831 #: opensuse-tumbleweed
832 msgid ""
833 "The workaround for B<reallocarray>() in glibc \\[em]which shares the same "
834 "bug\\[em] would be I<\\%reallocarray(p,\\ n?n:1,\\ size?size:1)>."
835 msgstr ""
836
837 #. type: SH
838 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
839 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
840 #, no-wrap
841 msgid "EXAMPLES"
842 msgstr "EXEMPLOS"
843
844 #. type: Plain text
845 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
846 #: opensuse-leap-16-1 opensuse-tumbleweed
847 #, no-wrap
848 msgid ""
849 "#include E<lt>err.hE<gt>\n"
850 "#include E<lt>stddef.hE<gt>\n"
851 "#include E<lt>stdio.hE<gt>\n"
852 "#include E<lt>stdlib.hE<gt>\n"
853 "#include E<lt>string.hE<gt>\n"
854 "\\&\n"
855 "#define MALLOCARRAY(n, type) ((type *) my_mallocarray(n, sizeof(type)))\n"
856 "#define MALLOC(type) MALLOCARRAY(1, type)\n"
857 "\\&\n"
858 "static inline void *my_mallocarray(size_t n, size_t size);\n"
859 "\\&\n"
860 "int\n"
861 "main(void)\n"
862 "{\n"
863 " char *p;\n"
864 "\\&\n"
865 " p = MALLOCARRAY(32, char);\n"
866 " if (p == NULL)\n"
867 " err(EXIT_FAILURE, \"malloc\");\n"
868 "\\&\n"
869 " strlcpy(p, \"foo\", 32);\n"
870 " puts(p);\n"
871 "}\n"
872 "\\&\n"
873 "static inline void *\n"
874 "my_mallocarray(size_t n, size_t size)\n"
875 "{\n"
876 " return reallocarray(NULL, n, size);\n"
877 "}\n"
878 msgstr ""
879
880 #. type: SH
881 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
882 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
883 #, no-wrap
884 msgid "SEE ALSO"
885 msgstr "VEJA TAMBÉM"
886
887 #. type: Plain text
888 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
889 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
890 msgid ""
891 "B<valgrind>(1), B<brk>(2), B<mmap>(2), B<alloca>(3), B<malloc_get_state>(3), "
892 "B<malloc_info>(3), B<malloc_trim>(3), B<malloc_usable_size>(3), "
893 "B<mallopt>(3), B<mcheck>(3), B<mtrace>(3), B<posix_memalign>(3)"
894 msgstr ""
895 "B<valgrind>(1), B<brk>(2), B<mmap>(2), B<alloca>(3), B<malloc_get_state>(3), "
896 "B<malloc_info>(3), B<malloc_trim>(3), B<malloc_usable_size>(3), "
897 "B<mallopt>(3), B<mcheck>(3), B<mtrace>(3), B<posix_memalign>(3)"
898
899 #. type: Plain text
900 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
901 #: opensuse-tumbleweed
902 msgid ""
903 "For details of the GNU C library implementation, see E<.UR https:\\://"
904 "sourceware.org/glibc/wiki/MallocInternals> E<.UE .>"
905 msgstr ""
906
907 #. type: TH
908 #: debian-trixie
909 #, no-wrap
910 msgid "2024-05-02"
911 msgstr "2 maio 2024"
912
913 #. type: TH
914 #: debian-trixie
915 #, no-wrap
916 msgid "Linux man-pages 6.9.1"
917 msgstr "Linux man-pages 6.9.1"
918
919 #. type: Plain text
920 #: debian-trixie
921 msgid "Standard C library (I<libc>, I<-lc>)"
922 msgstr "Biblioteca C Padrão (I<libc>, I<-lc>)"
923
924 #. type: Plain text
925 #: debian-trixie
926 #, fuzzy, no-wrap
927 #| msgid ""
928 #| "B<void *malloc(size_t >I<size>B<);>\n"
929 #| "B<void free(void >I<*ptr>B<);>\n"
930 #| "B<void *calloc(size_t >I<nmemb>B<, size_t >I<size>B<);>\n"
931 #| "B<void *realloc(void >I<*ptr>B<, size_t >I<size>B<);>\n"
932 #| "B<void *reallocarray(void >I<*ptr>B<, size_t >I<nmemb>B<, size_t >I<size>B<);>\n"
933 msgid ""
934 "B<void *malloc(size_t >I<size>B<);>\n"
935 "B<void free(void *_Nullable >I<ptr>B<);>\n"
936 "B<void *calloc(size_t >I<nmemb>B<, size_t >I<size>B<);>\n"
937 "B<void *realloc(void *_Nullable >I<ptr>B<, size_t >I<size>B<);>\n"
938 "B<void *reallocarray(void *_Nullable >I<ptr>B<, size_t >I<nmemb>B<, size_t >I<size>B<);>\n"
939 msgstr ""
940 "B<void *malloc(size_t >I<tamanho>B<);>\n"
941 "B<void free(void >I<*ptr>B<);>\n"
942 "B<void *calloc(size_t >I<nmemb>B<, size_t >I<tamanho>B<);>\n"
943 "B<void *realloc(void >I<*ptr>B<, size_t >I<tamanho>B<);>\n"
944 "B<void *reallocarray(void >I<*ptr>B<, size_t >I<nmemb>B<, size_t >I<tamanho>B<);>\n"
945
946 #. type: Plain text
947 #: debian-trixie fedora-44 fedora-rawhide
948 #, fuzzy
949 #| msgid ""
950 #| "B<free()> frees the memory space pointed to by I<ptr>, which must have "
951 #| "been returned by a previous call to B<malloc()>, B<calloc()> or "
952 #| "B<realloc()>. Otherwise, or if B<free(>I<ptr>B<)> has already been "
953 #| "called before, undefined behaviour occurs. If I<ptr> is B<NULL>, no "
954 #| "operation is performed."
955 msgid ""
956 "The B<free>() function frees the memory space pointed to by I<ptr>, which "
957 "must have been returned by a previous call to B<malloc>() or related "
958 "functions. Otherwise, or if I<ptr> has already been freed, undefined "
959 "behavior occurs. If I<ptr> is NULL, no operation is performed."
960 msgstr ""
961 "B<free()> libera o espaço de memória apontado por I<ptr>, o qual precisa ter "
962 "sido retornado por uma chamada anterior para B<malloc()>, B<calloc()> ou "
963 "B<realloc()>. Caso contrário, ou se B<free(>I<ptr>B<)> já tenha sido chamada "
964 "antes, um comportamento indefinido ocorre. Se I<ptr> for B<NULO>, nenhuma "
965 "operação será executada."
966
967 #. type: Plain text
968 #: debian-trixie
969 msgid ""
970 "The B<calloc>() function allocates memory for an array of I<nmemb> elements "
971 "of I<size> bytes each and returns a pointer to the allocated memory. The "
972 "memory is set to zero. If I<nmemb> or I<size> is 0, then B<calloc>() "
973 "returns a unique pointer value that can later be successfully passed to "
974 "B<free>()."
975 msgstr ""
976
977 #. type: Plain text
978 #: debian-trixie
979 msgid ""
980 "If the multiplication of I<nmemb> and I<size> would result in integer "
981 "overflow, then B<calloc>() returns an error. By contrast, an integer "
982 "overflow would not be detected in the following call to B<malloc>(), with "
983 "the result that an incorrectly sized block of memory would be allocated:"
984 msgstr ""
985
986 #. type: Plain text
987 #: debian-trixie
988 #, no-wrap
989 msgid "malloc(nmemb * size);\n"
990 msgstr ""
991
992 #. type: Plain text
993 #: debian-trixie fedora-44 fedora-rawhide
994 #, fuzzy
995 #| msgid ""
996 #| "B<realloc()> changes the size of the memory block pointed to by I<ptr> to "
997 #| "I<size> bytes. The contents will be unchanged to the minimum of the old "
998 #| "and new sizes; newly allocated memory will be uninitialized. If I<ptr> "
999 #| "is B<NULL>, the call is equivalent to B<malloc(size)>; if size is equal "
1000 #| "to zero, the call is equivalent to B<free(>I<ptr>B<)>I<.> Unless I<ptr> "
1001 #| "is B<NULL>, it must have been returned by an earlier call to B<malloc()>, "
1002 #| "B<calloc()> or B<realloc()>."
1003 msgid ""
1004 "The B<realloc>() function changes the size of the memory block pointed to "
1005 "by I<ptr> to I<size> bytes. The contents of the memory will be unchanged in "
1006 "the range from the start of the region up to the minimum of the old and new "
1007 "sizes. If the new size is larger than the old size, the added memory will "
1008 "I<not> be initialized."
1009 msgstr ""
1010 "B<realloc()> altera o tamanho do bloco de memória apontado por I<ptr> para "
1011 "I<tamanho> bytes. O conteúdo não será alterado para o mínimo dos tamanhos "
1012 "antigo e novo; a memória recém-alocada não será inicializada. Se I<ptr> for "
1013 "B<NULO>, a chamada será equivalente a B<malloc(tamanho)>; se o tamanho for "
1014 "igual a zero, a chamada será equivalente a B<free(>I<ptr>B<)>I<.> A menos "
1015 "que I<ptr> seja B<NULO>, ele precisa ter sido retornado por uma chamada "
1016 "anterior para to B<malloc()>, B<calloc()> ou B<realloc()>."
1017
1018 #. type: Plain text
1019 #: debian-trixie fedora-44 fedora-rawhide
1020 msgid ""
1021 "If I<ptr> is NULL, then the call is equivalent to I<malloc(size)>, for all "
1022 "values of I<size>."
1023 msgstr ""
1024
1025 #. type: Plain text
1026 #: debian-trixie fedora-44 fedora-rawhide
1027 msgid ""
1028 "If I<size> is equal to zero, and I<ptr> is not NULL, then the call is "
1029 "equivalent to I<free(ptr)> (but see \"Nonportable behavior\" for portability "
1030 "issues)."
1031 msgstr ""
1032
1033 #. type: Plain text
1034 #: debian-trixie fedora-44 fedora-rawhide
1035 msgid ""
1036 "Unless I<ptr> is NULL, it must have been returned by an earlier call to "
1037 "B<malloc> or related functions. If the area pointed to was moved, a "
1038 "I<free(ptr)> is done."
1039 msgstr ""
1040
1041 #. type: Plain text
1042 #: debian-trixie
1043 msgid ""
1044 "The B<reallocarray>() function changes the size of (and possibly moves) "
1045 "the memory block pointed to by I<ptr> to be large enough for an array of "
1046 "I<nmemb> elements, each of which is I<size> bytes. It is equivalent to the "
1047 "call"
1048 msgstr ""
1049
1050 #. type: Plain text
1051 #: debian-trixie
1052 #, no-wrap
1053 msgid "realloc(ptr, nmemb * size);\n"
1054 msgstr ""
1055
1056 #. type: Plain text
1057 #: debian-trixie fedora-44 fedora-rawhide
1058 #, fuzzy
1059 #| msgid ""
1060 #| "B<realloc()> returns a pointer to the newly allocated memory, which is "
1061 #| "suitably aligned for any kind of variable and may be different from "
1062 #| "I<ptr>, or B<NULL> if the request fails or if size was equal to 0. If "
1063 #| "B<realloc()> fails the original block is left untouched - it is not freed "
1064 #| "or moved."
1065 msgid ""
1066 "The B<realloc>() and B<reallocarray>() functions return NULL if I<ptr> is "
1067 "not NULL and the requested size is zero; this is not considered an error. "
1068 "(See \"Nonportable behavior\" for portability issues.) Otherwise, the "
1069 "returned pointer may be the same as I<ptr> if the allocation was not moved "
1070 "(e.g., there was room to expand the allocation in-place), or different from "
1071 "I<ptr> if the allocation was moved to a new address. If these functions "
1072 "fail, the original block is left untouched; it is not freed or moved."
1073 msgstr ""
1074 "B<realloc()> devolve um ponteiro à memória alocada, a qual é adequadamente "
1075 "alinhada para qualquer tipo de variável e pode ser diferente de I<ptr>, ou "
1076 "B<NULO> se o pedido falhar ou se o tamanho for igual a 0. Se B<realloc()> "
1077 "falhar, o bloco original não é alterado - ele não é liberado nem movido."
1078
1079 #. type: Plain text
1080 #: debian-trixie fedora-44 fedora-rawhide
1081 msgid "C11, POSIX.1-2008."
1082 msgstr "C11, POSIX.1-2008."
1083
1084 #. type: Plain text
1085 #: debian-trixie fedora-44 fedora-rawhide
1086 msgid "None."
1087 msgstr ""
1088
1089 #. type: Plain text
1090 #: debian-trixie
1091 #, no-wrap
1092 msgid ""
1093 "#include E<lt>err.hE<gt>\n"
1094 "#include E<lt>stddef.hE<gt>\n"
1095 "#include E<lt>stdio.hE<gt>\n"
1096 "#include E<lt>stdlib.hE<gt>\n"
1097 "#include E<lt>string.hE<gt>\n"
1098 "\\&\n"
1099 "#define MALLOCARRAY(n, type) ((type *) my_mallocarray(n, sizeof(type)))\n"
1100 "#define MALLOC(type) MALLOCARRAY(1, type)\n"
1101 "\\&\n"
1102 "static inline void *my_mallocarray(size_t nmemb, size_t size);\n"
1103 "\\&\n"
1104 "int\n"
1105 "main(void)\n"
1106 "{\n"
1107 " char *p;\n"
1108 "\\&\n"
1109 " p = MALLOCARRAY(32, char);\n"
1110 " if (p == NULL)\n"
1111 " err(EXIT_FAILURE, \"malloc\");\n"
1112 "\\&\n"
1113 " strlcpy(p, \"foo\", 32);\n"
1114 " puts(p);\n"
1115 "}\n"
1116 "\\&\n"
1117 "static inline void *\n"
1118 "my_mallocarray(size_t nmemb, size_t size)\n"
1119 "{\n"
1120 " return reallocarray(NULL, nmemb, size);\n"
1121 "}\n"
1122 msgstr ""
1123
1124 #. type: Plain text
1125 #: debian-trixie fedora-44 fedora-rawhide
1126 msgid ""
1127 "For details of the GNU C library implementation, see E<.UR https://"
1128 "sourceware.org/glibc/wiki/MallocInternals> E<.UE .>"
1129 msgstr ""
1130
1131 #. type: TH
1132 #: fedora-44 fedora-rawhide
1133 #, no-wrap
1134 msgid "2024-11-17"
1135 msgstr "17 novembro 2024"
1136
1137 #. type: TH
1138 #: fedora-44 fedora-rawhide
1139 #, no-wrap
1140 msgid "Linux man-pages 6.13"
1141 msgstr "Linux man-pages 6.13"
1142
1143 #. type: Plain text
1144 #: fedora-44 fedora-rawhide
1145 #, fuzzy, no-wrap
1146 #| msgid ""
1147 #| "B<void *malloc(size_t >I<size>B<);>\n"
1148 #| "B<void free(void >I<*ptr>B<);>\n"
1149 #| "B<void *calloc(size_t >I<nmemb>B<, size_t >I<size>B<);>\n"
1150 #| "B<void *realloc(void >I<*ptr>B<, size_t >I<size>B<);>\n"
1151 #| "B<void *reallocarray(void >I<*ptr>B<, size_t >I<nmemb>B<, size_t >I<size>B<);>\n"
1152 msgid ""
1153 "B<void *malloc(size_t >I<size>B<);>\n"
1154 "B<void free(void *_Nullable >I<ptr>B<);>\n"
1155 "B<void *calloc(size_t >I<n>B<, size_t >I<size>B<);>\n"
1156 "B<void *realloc(void *_Nullable >I<ptr>B<, size_t >I<size>B<);>\n"
1157 "B<void *reallocarray(void *_Nullable >I<ptr>B<, size_t >I<n>B<, size_t >I<size>B<);>\n"
1158 msgstr ""
1159 "B<void *malloc(size_t >I<tamanho>B<);>\n"
1160 "B<void free(void >I<*ptr>B<);>\n"
1161 "B<void *calloc(size_t >I<nmemb>B<, size_t >I<tamanho>B<);>\n"
1162 "B<void *realloc(void >I<*ptr>B<, size_t >I<tamanho>B<);>\n"
1163 "B<void *reallocarray(void >I<*ptr>B<, size_t >I<nmemb>B<, size_t >I<tamanho>B<);>\n"
1164
1165 #. type: Plain text
1166 #: fedora-44 fedora-rawhide
1167 msgid ""
1168 "The B<reallocarray>() function changes the size of (and possibly moves) "
1169 "the memory block pointed to by I<ptr> to be large enough for an array of "
1170 "I<n> elements, each of which is I<size> bytes. It is equivalent to the call"
1171 msgstr ""
1172
1173 #. type: Plain text
1174 #: fedora-44 fedora-rawhide
1175 #, no-wrap
1176 msgid "realloc(ptr, n * size);\n"
1177 msgstr ""
1178
1179 #. type: TH
1180 #: mageia-cauldron
1181 #, no-wrap
1182 msgid "Linux man-pages 6.17"
1183 msgstr "Linux man-pages 6.17"
1184
1185 #. type: TH
1186 #: opensuse-leap-16-1 opensuse-tumbleweed
1187 #, no-wrap
1188 msgid "Linux man-pages (unreleased)"
1189 msgstr "Linux man-pages (não lançado)"