Thread: [Plugin] PAWN memory access plugin
View Single Post
Old 22/11/2017, 05:53 AM   #7
Join Date: Mar 2010
Location: Germany
Posts: 1,048
Reputation: 359
Default Re: PAWN memory access plugin

The concept of managed and unmanaged memory is not from C. Allocating managed memory in this context stores extra information such as the validity of a pointer and the size of the allocated block of memory. These information are used on calls to validate input, also on plugin unload all "managed" blocks of memory are freed back to the underlying system. Allocating unmanaged memory in this context doesn't really hold the information of the validity of a pointer, neither the size of the allocated block of memory. This concludes that the operations are faster, but they're prone to get misused by programmers, which then can mess up the working virtual memory space by using invalid pointers or overwriting blocks of memory that were not allocated, or used by different program code. Also "unmanaged" memory is not explicitly freed at plugin unload. The counterpart of MEM_new* and MEM_clone is MEM_delete, where the counterpart of MEM_UM_new* and MEM_UM_clone is MEM_UM_delete.

Last edited by BigETI; 22/11/2017 at 12:51 PM.
BigETI is offline   Reply With Quote