The invention relates to a method for safely using a memory in a user mode program
signal processing function. According to the method, through pre-distribution and lock-free chain table operation, calling of a C
library function of non-asynchronous
signal security in a
signal processing function is completely avoided, and the
deadlock problem in
signal processing is fundamentally solved. The memory allocation and
recovery operation is simplified into modification of a
linked list pointer, the speed is far higher than that of a traditional general
memory allocator,
delay of a
signal processing function is greatly reduced, and programs such as a
debugger with extremely high requirements for stability and real-time performance are made to be more robust when asynchronous signals are processed. Through a dynamic expansion and intelligent contraction mechanism, a large number of sudden signal events can be dealt with, redundant resources can be released in time when the
system is idle, and the balance of
resource use efficiency is realized. The method does not depend on any specific hardware or
operating system characteristics, can be realized by all platforms supporting
mmap and signal mechanisms, and has wide applicability.