mirror of
https://github.com/MaJerle/lwmem.git
synced 2025-02-07 14:14:10 +08:00
Update docs
This commit is contained in:
parent
64fd18a164
commit
415e7451bd
@ -1,7 +1,5 @@
|
|||||||
#include "lwmem/lwmem.h"
|
#include "lwmem/lwmem.h"
|
||||||
|
|
||||||
void* ptr;
|
|
||||||
|
|
||||||
/* Create regions, address and length of regions */
|
/* Create regions, address and length of regions */
|
||||||
static
|
static
|
||||||
lwmem_region_t regions[] = {
|
lwmem_region_t regions[] = {
|
||||||
@ -15,12 +13,17 @@ lwmem_region_t regions[] = {
|
|||||||
/* Assign regions for manager */
|
/* Assign regions for manager */
|
||||||
lwmem_assignmem(regions, sizeof(regions) / sizeof(regions[0]));
|
lwmem_assignmem(regions, sizeof(regions) / sizeof(regions[0]));
|
||||||
|
|
||||||
ptr = lwmem_malloc(8); /* Allocate 8 bytes of memory */
|
/* Usage in program... */
|
||||||
|
|
||||||
|
void* ptr;
|
||||||
|
/* Allocate 8 bytes of memory */
|
||||||
|
ptr = lwmem_malloc(8);
|
||||||
if (ptr != NULL) {
|
if (ptr != NULL) {
|
||||||
/* Allocation successful */
|
/* Allocation successful */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Later... */ /* Free allocated memory */
|
/* Later... */
|
||||||
|
/* Free allocated memory when not used */
|
||||||
lwmem_free(ptr);
|
lwmem_free(ptr);
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
/* .. or */
|
/* .. or */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user