The invention discloses a memory error detection method and
system suitable for an
electric energy meter and a use and acquisition terminal, and relates to the technical field of
computer software security. According to the method, a
memory management function is hijacked, and
distributed memory blocks are contained in a unified
memory pool for management, wherein each
memory block comprises a
metadata structure, a prefix and suffix filling area and a element searching pointer; during memory allocation, request validity check is carried out, a
memory block structure is initialized, and during memory release, various memory errors are detected by verifying the element searching pointer offset, the
metadata magic number, the
checksum and the completeness of the filling area. The
system correspondingly comprises a
memory management function hijacking module, a
memory pool management module, a memory allocation
processing module and a memory release
processing module. According to the method, source codes do not need to be modified or instrumented, the overhead during operation is reduced, meanwhile, the detection capacity for errors such as illegal release, repeated release and out-of-border writing is expanded, and the method is suitable for development and debugging environments with high performance requirements.