📄 libmpatrol.ps
字号:
(CHECKFORK)2.5 E F0(option.)2.5 E 1.059(Memory allocation pro\214ling is supported, with statistics about e)108597.6 R -.15(ve)-.25 G 1.059(ry memory allocation and deallocation).15 F.043(that w)108 609.6 R .043(as made during the e)-.1 F -.15(xe)-.15 G.043(cution of a program being written to a \214le at program terminati\on if the).15 F F1(PR)2.544 E(OF)-.3 E F0 .233(option is used.)108 621.6R .232(The information stored in this \214le can then be used by the)5.232 F F1(mpr)2.732 E(of)-.18 E F0 .232(command to display v)2.732 F(ari-)-.25 E .32(ous tables summarising the memory allocation beha)108633.6 R .32(viour of the program that produced it.)-.2 F .32(Memory alloca-)5.32 F .565(tion tracing is also supported, where a tra\ce of all memory allocations, reallocations and deallocations can)108645.6 R 1.011(be written to a tracing output \214le in a concise encode\d format for later processing by the)108 657.6 R F1(mptrace)3.512 E F0(com-)3.512 E 2.5(mand. This)108 669.6 R(is controlled with the)2.5 E F1(TRA)2.5 E(CE)-.55 E F0(option.)2.5 E/F3 10.95/Times-Bold@0 SF(FUNCTIONS)72 686.4 Q F0 .233(The follo)108 698.4 R .233(wing 19 functions are a)-.25 F -.25(va)-.2 G .233(ilable as replacements for e).25 F .232(xisting C library functions.)-.15 F 1.832 -.8(To u)5.232 H .232(se these you).8 F .377(must include)108 710.4 R F2(mpatr)2.877 E(ol.h)-.45 E F0 .377(before all other header \214les, although on UNIX and W)2.877 F(indo)-.4 E .378(ws platforms \(and Ami-)-.25 F -.05(ga)108 722.4 S .61(OS when using).05 F F1(gcc)3.11 E F0 3.11(\)t)C(he)-3.11 E 3.11(yw)-.15G .61(ill be used an)-3.11 F(yw)-.15 E(ay)-.1 E 3.109(,a)-.65 G .609(lbeit with slightly less tracing information.)-3.109 F(If)5.609 E F1(alloca)3.109 E F0(is)3.109 E(Release 1.4)72 768 Q 2.5(8J)157.35 G(anuary 2002)-2.5 E(3)198.45 E EP%%Page: 4 4%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF(LIBMP)72 48 Q -1.11(AT)-.92 G -.4(RO)1.11 G128.245(L\(3\) mpatrol).4 F 128.245(library LIBMP)2.5 F -1.11(AT)-.92 G-.4(RO)1.11 G(L\(3\)).4 E .278(being used and)108 84 R/F1 10/Times-Italic@0 SF(alloca.h)2.778 E F0 .278(is included then)2.778 F F1(mpatr)2.778 E(ol.h)-.45 E F0 .278(must appear after)2.778 F F1(alloca.h)2.778 E F0 .278(otherwise the deb)2.778 F .278(ugging v)-.2 F(er)-.15 E(-)-.2 E(sion of)108 96 Q/F2 10/Times-Bold@0 SF(alloca)2.5 EF0(will not be used:)2.5 E F2(malloc)108 112.8 Q F0(Allocates)7.67 E F1(size)2.742 E F0 .242(uninitialised bytes from the heap and returns a p\ointer to the \214rst byte of the alloca-)2.742 F 2.752(tion. The)144124.8 R .252(pointer returned will be suitably aligned for casting to an)2.752 F2.752(yt)-.15 G .253(ype and can be used to store)-2.752 F .157(data of up to)144 136.8 R F1(size)2.657 E F0 .157(bytes in length.)2.657 F(If)5.156 E F1(size)2.656 E F0(is)2.656 E F1(0)2.656 E F0 .156(then the memory allocated will be implicitly rounded)2.656 F .914(up to)144 148.8 R F1(1)3.414 E F0 3.414(byte. If)3.414 F .914(there is\ not enough space in the heap then the null pointer will be returned an\d)3.414 F F2(err)144 160.8 Q(no)-.15 E F0 .705(will be set to)3.205 F F2(ENOMEM)3.205 E F0 5.705(.T)C .705(he allocated memory must be deallocated with)-5.705 F F2(fr)3.204 E(ee)-.18 E F0 .704(or reallo-)3.204 F(cated with)144 172.8 Q F2 -.18(re)2.5G(alloc).18 E F0(.)A F2(calloc)108 189.6 Q F0(Allocates)11.56 E F1(nelem)3.256 E F0 .756(elements of)3.256 F F1(size)3.256 E F0 .757(zero-initialised bytes from the heap and returns a pointer to the)3.256F .978(\214rst byte of the allocation.)144 201.6 R .977(The pointer returned will be suitably aligned for casting to an)5.978 F3.477(yt)-.15 G(ype)-3.477 E .782(and can be used to store data of up to)144 213.6 R F1 .783(nelem * size)3.283 F F0 .783(bytes in length.)3.283 F(If)5.783 E F1.783(nelem * size)3.283 F F0(is)3.283 E F1(0)3.283 E F0 .783(then the)3.283 F .372(amount of memory allocated will be implicitly rounded up to)144 225.6 RF1(1)2.872 E F0 2.872(byte. If)2.872 F .371(there is not enough space)2.872 F .684(in the heap then the null pointer will be returned and)144237.6 R F2(err)3.184 E(no)-.15 E F0 .684(will be set to)3.184 F F2(ENOMEM)3.184 E F0 5.684(.T)C .684(he allo-)-5.684 F(cated memory must be deallocated with)144 249.6 Q F2(fr)2.5 E(ee)-.18 EF0(or reallocated with)2.5 E F2 -.18(re)2.5 G(alloc).18 E F0(.)A F2(memalign)108 266.4 Q F0(Allocates)144 278.4 Q F1(size)2.742 E F0 .242(\uninitialised bytes from the heap and returns a pointer to the \214rst \byte of the alloca-)2.742 F 2.663(tion. The)144 290.4 R .163(pointer returned will be aligned to)2.663 F F1(align)2.663 E F0 .164(bytes and can be used to store data of up to)2.663 F F1(size)2.664 E F0.747(bytes in length.)144 302.4 R(If)5.747 E F1(align)3.247 E F0 .746(is zero then the def)3.247 F .746(ault system alignment will be used.)-.1 F(If)5.746 E F1(align)3.246 E F0 .746(is not a)3.246 F(po)144 314.4Q .755(wer of tw)-.25 F 3.255(ot)-.1 G .755(hen it will be rounded up to the nearest po)-3.255 F .755(wer of tw)-.25 F 3.255(o. If)-.1 F F1(align)3.255 E F0 .755(is greater than the)3.255 F .229(system page size then it will be truncated to that v)144326.4 R 2.729(alue. If)-.25 F F1(size)2.729 E F0(is)2.729 E F1(0)2.729 EF0 .229(then the memory allocated will)2.729 F .654(be implicitly rounded up to)144 338.4 R F1(1)3.154 E F0 3.154(byte. If)3.154 F .654(there is not enough space in the heap then the null pointer)3.154 F.433(will be returned and)144 350.4 R F2(err)2.933 E(no)-.15 E F0 .433(will be set to)2.933 F F2(ENOMEM)2.933 E F0 5.433(.T)C .432(he allocated memory must be deallocated)-5.433 F(with)144 362.4 Q F2(fr)3.99 E(ee)-.18 E F0 1.49(or reallocated with)3.99 F F2 -.18(re)3.99G(alloc).18 E F0 3.99(,a)C 1.49(lthough the latter will not guarantee the preserv)-3.99 F 1.49(ation of)-.25 F(alignment.)144 374.4 Q F2 -.1(va)108 391.2 S(lloc).1 EF0(Allocates)11.1 E F1(size)2.742 E F0 .242(uninitialised bytes from th\e heap and returns a pointer to the \214rst byte of the alloca-)2.742 F2.804(tion. The)144 403.2 R .305(pointer returned will be aligned to th\e system page size and can be used to store data of)2.804 F .134(up to)144 415.2 R F1(size)2.634 E F0 .134(bytes in length.)2.634 F(If)5.134 EF1(size)2.634 E F0(is)2.634 E F1(0)2.634 E F0 .134(then the memory allocated will be implicitly rounded up to)2.634 F F1(1)2.634 E F0 2.724(byte. If)144 427.2 R .225(there is not enough space\ in the heap then the null pointer will be returned and)2.724 F F2(err)2.725 E(no)-.15 E F0(will)2.725 E 1.201(be set to)144 439.2 R F2(ENOMEM)3.701 E F0 6.201(.T)C 1.201(he allocated memory must be deallocated with)-6.201 F F2(fr)3.7 E(ee)-.18 E F0 1.2(or reallocated with)3.7 F F2 -.18(re)144 451.2 S(alloc).18E F0 2.5(,a)C(lthough the latter will not guarantee the preserv)-2.5 E(ation of alignment.)-.25 E F2(pv)108 468 Q(alloc)-.1 E F0(Allocates)5.54 E F1(size)2.741 E F0 .242(uninitialised bytes from the heap and re\turns a pointer to the \214rst byte of the alloca-)2.741 F 2.805(tion. The)144 480 R .305(pointer returned will be aligned to the syste\m page size and can be used to store data of)2.805 F .134(up to)144 492R F1(size)2.634 E F0 .134(bytes in length.)2.634 F(If)5.134 E F1(size)2.634 E F0(is)2.634 E F1(0)2.634 E F0 .134(then the memory allocated will be implicitly rounded up to)2.634 F F1(1)2.634 E F0 .135(page, otherwise)144 504 R F1(size)2.635 E F0 .135(will be implicitly rounded up to a multiple of the system page size.)2.635 F .135(If there is)5.135 F 1.888(not enough space in the heap the\n the null pointer will be returned and)144 516 R F2(err)4.388 E(no)-.15E F0 1.888(will be set to)4.388 F F2(ENOMEM)144 528 Q F0 6.579(.T)C1.579(he allocated memory must be deallocated with)-6.579 F F2(fr)4.078E(ee)-.18 E F0 1.578(or reallocated with)4.078 F F2 -.18(re)4.078 G(alloc).18 E F0(,)A(although the latter will not guarantee the preserv)144 540 Q(ation of alignment.)-.25 E F2(alloca)108 556.8 Q F0(Allocates)11 E F1(size)2.808 E F0 .309(temporary uninitialised bytes from the hea\p and returns a pointer to the \214rst byte of)2.808 F 1.187(the allocation.)144 568.8 R 1.187(The pointer returned will be suitably aligned for casting to an)6.187 F3.687(yt)-.15 G 1.186(ype and can be)-3.687 F 1.329(used to store data of up to)144 580.8 R F1(size)3.829 E F0 1.329(bytes in length.)3.829 F(If)6.33 E F1(size)3.83 E F0(is)3.83 E F1(0)3.83 E F0 1.33(then the memory allocated will be)3.83 F .363(implicitly rounded up to)144 592.8 R F1(1)2.862 E F0 2.862(byte. If)2.862 F .362(there is not enough space in the heap then the program will be)2.862 F1.97(terminated and the)144 604.8 R F1(OUTMEM)4.47 E F0 1.971(error will be gi)4.471 F -.15(ve)-.25 G 4.471(n. The).15 F F2(alloca)4.471 E F0 1.971(function normally allocates its)4.471 F 1.021(memory f\rom the stack, with the result that all such allocations will be freed \when the function)144 616.8 R 4.312(returns. This)144 628.8 R -.15(ve)4.312 G 1.812(rsion of).15 F F2(alloca)4.312 E F0 1.813(allocates its memory from the heap in order to pro)4.312 F 1.813(vide better)-.15 F(deb)144 640.8 Q 2.645(ugging, b)-.2 F 2.644(ut the \allocations may not necessarily be freed immediately when the function)-.2 F 2.74(returns. The)144 652.8 R .24(allocated memory can be deallocated e)2.74 F .24(xplicitly with)-.15 FF2(dealloca)2.74 E F0 2.74(,b)C .24(ut may not be reallo-)-2.94 F .26(cated or deallocated in an)144 664.8 R 2.759(yo)-.15 G .259(ther w)-2.759 F(ay)-.1 E 5.259(.T)-.65 G .259(his function is a)-5.259 F -.25(va)-.2 G .259(ilable for backw).25 F .259(ards compatibility with)-.1 F(older C source code and should not be used in ne)144 676.8 Q 2.5(wc)-.25 G(ode.)-2.5 E F2(strdup)108 693.6 Q F0 1.266(Allocates e)7.66 F1.267(xactly enough memory from the heap to duplicate)-.15 F F1(str)3.767 E F0 1.267(\(including the terminating nul)3.767 F 1.015(characte\r\) and returns a pointer to the \214rst byte of the allocation after c\op)144 705.6 R(ying)-.1 E F1(str)3.515 E F0 1.015(to the ne)3.515 F(wly-)-.25 E 1.337(allocated memory)144 717.6 R 6.337(.T)-.65 G 1.338(he pointer returned will ha)-6.337 F 1.638 -.15(ve n)-.2 H 3.838(oa).15G 1.338(lignment constraints and can be used to)-3.838 F .242(store character data up to the length of)144 729.6 R F1(str)2.742 E F05.242(.I)C(f)-5.242 E F1(str)2.741 E F0(is)2.741 E F2(NULL)2.741 E F0.241(then an error will be gi)2.741 F -.15(ve)-.25 G 2.741(na).15 G .241(nd the null)-2.741 F(Release 1.4)72 768 Q 2.5(8J)157.35 G(anuary 2002)-2.5 E(4)198.45 E EP%%Page: 5 5%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF(LIBMP)72 48 Q -1.11(AT)-.92 G -.4(RO)1.11 G128.245(L\(3\) mpatrol).4 F 128.245(library LIBMP)2.5 F -1.11(AT)-.92 G-.4(RO)1.11 G(L\(3\)).4 E 1.355(pointer will be returned.)144 84 R 1.355(If there is not enough space in the heap then the null pointer will be)6.355 F 1.158(returned and)144 96 R/F1 10/Times-Bold@0 SF(err)3.658 E(no)-.15 E F0 1.158(will be set to)3.658 F F1(ENOMEM)3.658 E F0 6.158(.T)C 1.158(he allocated memory must be deallocated with)-6.158 F F1(fr)144 108 Q(ee)-.18 E F0(or reallocated with)2.5 E F1 -.18(re)2.5 G(alloc).18 E F0(.)A F1(str)108 124.8 Q(ndup)-.15 E F0 1.266(Allocates e)144136.8 R 1.267(xactly enough memory from the heap to duplicate)-.15 F/F210/Times-Italic@0 SF(str)3.767 E F0 1.267(\(including the terminating nul)3.767 F 1.015(character\) and returns \a pointer to the \214rst byte of the allocation after cop)144 148.8 R(ying)-.1 E F2(str)3.515 E F0 1.015(to the ne)3.515 F(wly-)-.25 E 1.337(allocated memory)144 160.8 R 6.337(.T)-.65 G 1.338(he pointer returned will ha)-6.337 F 1.638 -.15(ve n)-.2 H 3.838(oa).15G 1.338(lignment constraints and can be used to)-3.838 F .47(store character data up to the length of)144 172.8 R F2(str)2.97 E F05.47(.I)C(f)-5.47 E F2(str)2.97 E F0(is)2.97 E F1(NULL)2.97 E F0(and)2.97 E F2(size)2.97 E F0 .47(is non-zero then an error will)2.97 F .072(be gi)144 184.8 R -.15(ve)-.25 G 2.572(na).15 G .072(nd the null pointer will be returned.)-2.572 F .073(If the length of)5.072 F F2(str)2.573 E F0 .073(is greater than)2.573 F F2(size)2.573 EF0 .073(then only)2.573 F F2(size)2.573 E F0 .641(characters will be al\located and copied, with one additional byte for the nul character)144196.8 R 5.641(.I)-.55 G 3.141(ft)-5.641 G .641(here is)-3.141 F 1.888(n\ot enough space in the heap then the null pointer will be returned and)144 208.8 R F1(err)4.388 E(no)-.15 E F0 1.888(will be set to)4.388 F F1(ENOMEM)144 220.8 Q F0 6.579(.T)C 1.579(he allocated memory must be deallocated with)-6.579 F F1(fr)4.078 E(ee)-.18 E F0 1.578(or reallocated with)4.078 F F1 -.18(re)4.078 G(alloc).18E F0(.)A 1.343(This function is a)144 232.8 R -.25(va)-.2 G 1.343(ilable for backw).25 F 1.344(ards compatibility with older C libraries and should not be)-.1 F(used in ne)144 244.8 Q 2.5(wc)-.25 G(ode.)-2.5 E F1(strsa)108 261.6 Q-.1(ve)-.25 G F0 1.267(Allocates e)6.46 F 1.267(xactly enough memory from the heap to duplicate)-.15 F F2(str)3.767 EF0 1.267(\(including the terminating nul)3.767 F 1.015(character\) and \returns a pointer to the \214rst byte of the allocation after cop)144273.6 R(ying)-.1 E F2(str)3.516 E F0 1.016(to the ne)3.516 F(wly-)-.25 E1.338(allocated memory)144 285.6 R 6.338(.T)-.65 G 1.338(he pointer returned will ha)-6.338 F 1.638 -.15(ve n)-.2 H 3.838(oa).15G 1.338(lignment constraints and can be used to)-3.838 F .241(store character data up to the length of)144 297.6 R F2(str)2.741 E F05.241(.I)C(f)-5.241 E F2(str)2.741 E F0(is)2.741 E F1(NULL)2.741 E F0.242(then an error will be gi)2.742 F -.15(ve)-.25 G 2.742(na).15 G .242(nd the null)-2.742 F 1.355(pointer will be returned.)144 309.6 R 1.355(If there is not enough space in the heap then the null pointer will be)6.355 F 1.157(returned and)144 321.6 R F1(err)3.657 E(no)-.15 E F0 1.158(will be set to)3.658 F F1(ENOMEM)3.658 E F0 6.158(.T)C 1.158(he allocated memory must be deallocated with)-6.158 F F1(fr)144 333.6 Q(ee)-.18 E F0 .303(or reallocated with)2.803 F F1 -.18(re)2.803 G(alloc).18 E F0 5.302(.T)C .302(his function is a)-5.302 F -.25(va)-.2 G .302(ilable for backw).25 F .302(ards compatibility with older)-.1 F 2.5(Cl)144 345.6 S(ibraries and should not be used in ne)-2.5 E 2.5(wc)-.25 G(ode.)-2.5 E F1(str)108 362.4 Q(nsa)-.15 E -.1(ve)-.25 G F0 1.266(Allocates e)144 374.4 R 1.267(xactly enough memory from the heap to duplicate)-.15 F F2(str)3.767 EF0 1.267(\(including the terminating nul)3.767 F 1.015(character\) and \returns a pointer to the \214rst byte of the allocation after cop)144386.4 R(ying)-.1 E F2(str)3.515 E F0 1.015(to the ne)3.515 F(wly-)-.25 E
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -