SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 21/11/2017, 12:38 PM   #1
BigETI
Gangsta
 
BigETI's Avatar
 
Join Date: Mar 2010
Location: Germany
Posts: 981
Reputation: 282
Default PAWN memory access plugin

PAWN memory access plugin
A successor to http://forum.sa-mp.com/showthread.php?t=451381


Description
The PAWN memory access plugin allows to allocate and free memory from heap in PAWN.


Project
All of the source code, builds and documentations are located at GitHub: https://github.com/BigETI/pawn-memory
BigETI is offline   Reply With Quote
Old 21/11/2017, 01:52 PM   #2
StrikerZ
High-roller
 
StrikerZ's Avatar
 
Join Date: Mar 2016
Location: India
Posts: 1,123
Reputation: 154
Default Re: PAWN memory access plugin

Good job! It'll be useful
__________________
StrikerZ is offline   Reply With Quote
Old 21/11/2017, 04:19 PM   #3
IlanZ
High-roller
 
IlanZ's Avatar
 
Join Date: Jul 2016
Location: Brasil
Posts: 1,381
Reputation: 75
Default Re: PAWN memory access plugin

Nice job.
IlanZ is offline   Reply With Quote
Old 21/11/2017, 04:26 PM   #4
TommyB
Beta Tester
 
TommyB's Avatar
 
Join Date: Sep 2010
Location: Texas, USA.
Posts: 153
Reputation: 133
Default Re: PAWN memory access plugin

10/10 best plugin ever used.
__________________
TommyB is offline   Reply With Quote
Old 21/11/2017, 05:02 PM   #5
DimaShift
Banned
 
Join Date: May 2017
Location: Republic of Moldova
Posts: 123
Reputation: 43
Default Re: PAWN memory access plugin

nice plugin! ++
DimaShift is offline   Reply With Quote
Old 21/11/2017, 06:26 PM   #6
Kaperstone
High-roller
 
Kaperstone's Avatar
 
Join Date: May 2011
Location: Russia
Posts: 3,353
Reputation: 822
Default Re: PAWN memory access plugin

I have weak knowledge in c, can it be explained what is the difference between managed and unmanaged if (anyway) I need to delete both of them to prevent memory leak?
__________________
Kaperstone is offline   Reply With Quote
Old 22/11/2017, 04:53 AM   #7
BigETI
Gangsta
 
BigETI's Avatar
 
Join Date: Mar 2010
Location: Germany
Posts: 981
Reputation: 282
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 11:51 AM.
BigETI is offline   Reply With Quote
Old 23/11/2017, 04:49 AM   #8
Whitetiger
Huge Clucker
 
Whitetiger's Avatar
 
Join Date: Nov 2007
Location: Greenville, NC, USA
Posts: 469
Reputation: 139
Default Re: PAWN memory access plugin

What's the advantage of this over your old plugin? Why would I wanna allocate memory on the PAWN heap when I can do the same thing without messing with PAWN's heap in your other plugin?
__________________
GitHub

Author of SA-MP AC

Whitetiger is offline   Reply With Quote
Old 23/11/2017, 11:44 AM   #9
BigETI
Gangsta
 
BigETI's Avatar
 
Join Date: Mar 2010
Location: Germany
Posts: 981
Reputation: 282
Default Re: PAWN memory access plugin

Memory is not allocated on PAWN heap memory. It is allocated on the application's heap memory.
BigETI is offline   Reply With Quote
Old 27/02/2018, 01:29 AM   #10
DavidZvla
Little Clucker
 
DavidZvla's Avatar
 
Join Date: Jul 2017
Location: Cosmos
Posts: 25
Reputation: 1
Default Re: PAWN memory access plugin

How i get the .dll or .so file? or how can i setup this plugin?

Code:
[debug] Run time error 19: "File or function is not found"
[debug]  MEM_get_val
[debug]  MEM_get_size
[debug]  MEM_get_arr
[debug]  MEM_delete
[debug]  MEM_new_arr
[debug]  MEM_set_val
[debug] Run time error 19: "File or function is not found"
[debug]  MEM_get_val
[debug]  MEM_get_size
[debug]  MEM_get_arr
[debug]  MEM_delete
[debug]  MEM_new_arr
[debug]  MEM_set_val
DavidZvla is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] Memory access plugin BigETI Plugin Development 54 23/11/2017 03:23 PM
Invalid Memory access Dayrion Scripting Help 11 08/08/2016 06:35 PM
How much random access memory Manowar Scripting Help 5 05/03/2013 07:47 AM
Invalid memory access Littl3j0hNy Scripting Help 5 03/12/2011 03:51 PM
Invalid memory access wouter0100 Scripting Help 4 17/09/2011 11:28 PM


All times are GMT. The time now is 09:31 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.