TMS34010 C Compiler - Al Kossow's Bitsavers
TMS34010 C Compiler - Al Kossow's Bitsavers
TMS34010 C Compiler - Al Kossow's Bitsavers
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
ealloc<br />
Change Heap Size<br />
Syntax #include <br />
Defined in<br />
Description<br />
void *realloc(ptr, size)<br />
void *ptr; /* pointer to object to change */<br />
size-t size; /* new size (in bytes) of packet */<br />
memory. c in rts. src<br />
The realloc function changes the size of the allocated memory pointed to<br />
by ptr, to the size specified in bytes by size. The contents of the memory<br />
space (up to the lesser of the old and new sizes) is not changed.<br />
• If ptr is 0, then realloc behaves like malloc.<br />
• If ptr points to unallocated space, the function takes no action and<br />
returns.<br />
• If the space cannot be allocated, the original memory space is not<br />
changed and realloc returns O.<br />
• If size=O and ptr is not null, then realloc frees the space that ptr<br />
points to.<br />
If, in oreler to allocate more space, the entire object must be moved, realloc<br />
returns a pointer to the new space. Any memory freed by this operation is<br />
deallocated. If an error occurs, the function returns a null pointer (0).<br />
The memory that realloc uses is in a special memory pool or heap. A C<br />
module called memory. c reserves memory for the heap in the .bss section.<br />
The constant MEMORY-SIZE defines the size of the heap as 1000 bytes. If<br />
necessary, you can change the size of the heap by change the value of<br />
MEMORY_SIZE and reassembling memory. c. For more information, see<br />
Section 5.1.3, Dynamic Memory <strong>Al</strong>location, on page 5-4.<br />
6-62