LWIP-Memory Management Function Description

Source: Internet
Author: User


1. mem_init (): Memory heap initialization function. It mainly sets the starting address of the memory heap and initializes the idle list. It is called during LWIP initialization and has an internal interface.


2. Void * mem_malloc (mem_size_t size)


It is not the address of the memory block. If the memory is allocated, null is returned. The requested memory heap is a global variable.


3. * mem_calloc (mem_size_t count, mem_size_t size): It is a simple packaging of the mem_malloc () function. There are two entry parameters. Count is the size of each element,


Size is the total number of elements. The product of the two parameters is the size of the actual memory space to be allocated. Unlike mem_malloc (), it clears the dynamically allocated memory. So many


The user will choose to call mem_calloc (). This will definitely clear 0 and avoid calling memset (). The returned value is the same as that of mem_malloc.


4. Void mem_free (void * rmem): memory release function. rmem is the first address of the memory block to be released.


5. mem_realloc (void * rmem, mem_size_t newsize): re-allocate memory, pointer name = (data type *) realloc (name of the pointer to change the memory size, new size ).


6. Static void plug_holes (struct mem * MEm): Merge adjacent and unused memory blocks. Call in mem_free

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.