• Home
  • Raw
  • Download

Lines Matching refs:lwsac

3 ![lwsac flow](/doc-assets/lwsac.svg)
10 not tracked by lwsac at all, there is a "used" high-water mark for each chunk
17 strings or other unstructured data, lwsac is significantly more efficient than
20 [lwsac full public api](https://libwebsockets.org/git/libwebsockets/tree/include/libwebsockets/lws-
26 * lwsac_use - allocate / use some memory from a lwsac
28 * \param head: pointer to the lwsac list object
35 * This also serves to init the lwsac if *head is NULL. Basically it does
42 lwsac_use(struct lwsac **head, size_t ensure, size_t chunk_size);
60 size, lwsac is extremely efficient even for huge numbers of small allocations.
62 This makes lwsac very effective when the total amount of allocation needed is
70 * lwsac_free - deallocate all chunks in the lwsac and set head NULL
72 * \param head: pointer to the lwsac list object
74 * This deallocates all chunks in the lwsac, then sets *head to NULL. All
78 lwsac_free(struct lwsac **head);
81 When you are finished with the lwsac, you simply free the chain of allocated
82 chunks using lwsac_free() on the lwsac head. There's no tracking or individual
86 If the structs stored in the lwsac allocated things **outside** the lwsac, then the
87 user must unwind through them and perform the frees. But the idea of lwsac is
88 things stored in the lwsac also suballocate into the lwsac, and point into the
89 lwsac if they need to, avoiding any need to visit them during destroy. It's
109 In some cases the input to be stored in the lwsac may repeat the same tokens
110 multiple times... if the pattern is to store the string or blob in the lwsac
115 lwsac_scan_extant(struct lwsac *head, uint8_t *find, size_t len, int nul);
118 This lets you check in all previous used parts of the lwsac for the same
120 it returns `NULL` and you can copy it into the lwsac as usual. If it is
126 If the lwsac will persist in the system for some time, it's desirable to reduce
129 - once per chunk... in addition to the malloc overhead, there's an lwsac
135 size of the overall lwsac in one hit. Then use a chunk size that is a tradeoff
141 You can measure the overhead in an lwsac using `lwsac_total_overhead()`.
143 The lwsac apis look first in the unused part of previous chunks, if any, and
145 case lwsac was forced to allocate a new chunk because you asked for something
147 just not enough for that particular allocation. Subsequent lwsac use can then