a1ccf15e39
This is a tool for associating discrete IDs with addresses. This tool is implemented through the red-black tree method provided by <sys/tree.h>, and the time complexity when calling, searching, and deleting is optimized to O(logn) The implementation is the moving node operation of two red-black trees 1. When applying for a node, it will first check whether there is an available node in the "removed" tree. If so, the memory address of the node will be reused and moved to the "alloced" tree. 2. If the "removed" tree is an "empty tree", then the node will be requested from the memory and added to the "alloced" tree 3. Similarly, when removing a node, we set the address pointed to in the node to "NULL" and move it to the "removed" tree. Next time we alloc the node, we can reduce the overhead caused by memory application For now, we still have something that can be optimized, and that is the memory elimination mechanism of the "removed tree". The current implementation will only release all the content under the "removed" tree when the idtree is destroyed. Signed-off-by: chenrun1 <chenrun1@xiaomi.com> |
||
---|---|---|
.. | ||
android | ||
arpa | ||
crypto | ||
cxx | ||
net | ||
netinet | ||
netpacket | ||
nuttx | ||
ssp | ||
sys | ||
.gitignore | ||
aio.h | ||
alloca.h | ||
assert.h | ||
byteswap.h | ||
ctype.h | ||
debug.h | ||
dirent.h | ||
dlfcn.h | ||
dsp.h | ||
dspb16.h | ||
elf32.h | ||
elf64.h | ||
elf.h | ||
endian.h | ||
err.h | ||
errno.h | ||
execinfo.h | ||
fcntl.h | ||
fixedmath.h | ||
fnmatch.h | ||
ftw.h | ||
getopt.h | ||
glob.h | ||
grp.h | ||
hex2bin.h | ||
iconv.h | ||
ifaddrs.h | ||
inttypes.h | ||
iso646.h | ||
langinfo.h | ||
libgen.h | ||
libintl.h | ||
limits.h | ||
locale.h | ||
lzf.h | ||
malloc.h | ||
mqueue.h | ||
netdb.h | ||
nl_types.h | ||
nxflat.h | ||
obstack.h | ||
poll.h | ||
pthread.h | ||
pty.h | ||
pwd.h | ||
regex.h | ||
resolv.h | ||
sched.h | ||
search.h | ||
semaphore.h | ||
signal.h | ||
spawn.h | ||
stdbool.h | ||
stddef.h | ||
stdint.h | ||
stdio.h | ||
stdlib.h | ||
stdnoreturn.h | ||
string.h | ||
strings.h | ||
syscall.h | ||
syslog.h | ||
termios.h | ||
threads.h | ||
time.h | ||
unistd.h | ||
utime.h | ||
uuid.h | ||
wchar.h | ||
wctype.h |