The invention discloses a
memory management method and device, and relates to the technical field of heterogeneous computing, and the method comprises the steps: obtaining a memory allocation request of a device, searching a page locking
memory block corresponding to the memory allocation request, and allocating the page locking
memory block to a corresponding device; receiving a request to release the
memory block, identifying device compute streams associated with the memory block, and recording a synchronization event for each compute
stream; the recorded synchronization event and
metadata of the memory block are associated and stored in a to-be-processed
event queue; querying whether the event in the to-be-processed
event queue is completed or not; when it is queried that the specific event is completed, the corresponding memory block is recycled to the free
memory pool, the technical problems that in the related technology, due to the fact that high-cost
memory management functions are called too frequently, performance is low,
collaboration with equipment
asynchronous operation is difficult, and data competition and errors are likely to be caused are solved, and the
memory management efficiency is improved. And the technical effect of greatly improving the memory allocation efficiency and the overall
throughput of the
system on the premise of ensuring the security of the memory is achieved.