SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 16/07/2013, 11:48 PM   #1
BigETI
Banned
 
Join Date: Mar 2010
Location: Germany
Posts: 1,048
Reputation: 359
Flowers [OBSOLETE] Memory access plugin

memory.dll (Win32) / memory.so (Ubuntu 14.01 LTS, Debian 7 Wheezy) / memory.inc
Memory access plugin
The predecessor of http://forum.sa-mp.com/showthread.php?t=645166



About
This plugin allows you to allocate dynamic memory, use it, and free it after you don't want to use it anymore.



Why?
PAWN literally doesn't allow you to manage dynamic memory at all. But still there has been releases such as for example y_malloc, which allows you to use dynamic memory in your PAWN scripts.
Speed comparison between y_malloc and this plugin can be found here:


Allow your scripts to shrink their AMX sizes, by using dynamic memory.



Documentation




Setup
Put the plugin binary into your server's "plugins" folder and set in server.cfg

Windows:

Code:
plugins memory
LINUX:
Code:
plugins memory.so
After that you can use the memory include in your scripts:
pawn Code:
// On top of your script
#include <memory>
// your code

Compile and run.


Alternatively you can use the secure version (which is slower by a fraction):

Windows:

Code:
plugins memory_secure
LINUX:
Code:
plugins memory_secure.so
Of course you can use the memory include in your scripts:
pawn Code:
// On top of your script
#define SECURE_MEMORY_PLUGIN
#include <memory>
// your code

Compile and run.



Downloads


Changelog

Quote:
  • v1.1.1 -> Code optimization
  • v1.1 -> Added MEM_copy(), MEM_zero(), MEM_E_res (secure only), MEM_is() (secure only), MEM_len() (secure only), and MEM_result() (secure only) ( 17.10.2013 )
  • v1.0.01 -> Updated SDK and changed the includes ( 17.07.2013 )
  • v1.0 -> Initial release ( 17.07.2013 )

Credits
If you are interested to compile this for Linux distributions, just let me know by personal messaging me and leave me links to download the compiled binar(y|ies).
You'll be added into the credits, of course.

Quote:
  • BigETI for the source code and compiled binaries for Windows distributions and Ubuntu 14.01 LTS
  • Bluescreen for compiling the plugins for Debian 7 Wheezy
  • SA:MP development team
  • ****** for the speed comparison idea
Thanks for their previous support:
Quote:
  • leonardo1434
  • Josstaa
  • Mellnik
  • Tenshi
  • Markô


Best Regards

~ BigETI

Last edited by BigETI; 23/11/2017 at 04:21 PM. Reason: Obsolete release
BigETI is offline   Reply With Quote
Old 16/07/2013, 11:53 PM   #2
Kitten
High-roller
 
Join Date: Jul 2010
Location: United States
Posts: 2,179
Reputation: 339
Default Re: Memory access plugin

AH I've been wanting something like this for years!
__________________
Download DayZ Gamemode CLICK HERE TO VISIT PGA

-- P.S Left SA:MP; it's pretty dead and it's way different than it used to be. Good luck y'all!
Kitten is offline   Reply With Quote
Old 16/07/2013, 11:55 PM   #3
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 2,929
Reputation: 700
Default Re: Memory access plugin

Nice release - I think I might even use this soon!
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 17/07/2013, 02:25 AM   #4
Red_Dragon.
High-roller
 
Red_Dragon.'s Avatar
 
Join Date: Sep 2012
Posts: 1,391
Reputation: 46
Default Re: Memory access plugin

Great release. I'll be using this soon!
Red_Dragon. is offline   Reply With Quote
Old 17/07/2013, 02:58 AM   #5
JustBored
High-roller
 
JustBored's Avatar
 
Join Date: Jan 2013
Location: Buenos Aires - Argentina
Posts: 1,150
Reputation: 134
Default Respuesta: Memory access plugin

Great release.
__________________
"Compiler - A program designed to tell you how wrong you are. It's a great way to induce stress and frustration."

JustBored is offline   Reply With Quote
Old 17/07/2013, 03:25 AM   #6
gtakillerIV
Gangsta
 
gtakillerIV's Avatar
 
Join Date: Sep 2011
Location: UAE, Sharjah.
Posts: 986
Reputation: 201
Default Re: Memory access plugin

Looks useful. Good job.
gtakillerIV is offline   Reply With Quote
Old 17/07/2013, 03:37 AM   #7
leonardo1434
High-roller
 
leonardo1434's Avatar
 
Join Date: Mar 2012
Posts: 1,669
Reputation: 179
Default Re: Memory access plugin

Nice release. I haven't look into the code well, quickly view. Anyway, i've compiled the Linux version for Ubuntu , lastest version, 32 bits. Also, i didn't made any test(just opened the SAMP-Server to check out), therefore, if any errors pops up, tell me and i'll work for a fix.

http://www.solidfiles.com/d/df11603217/
__________________
c++
leonardo1434 is offline   Reply With Quote
Old 17/07/2013, 04:58 AM   #8
BigETI
Banned
 
Join Date: Mar 2010
Location: Germany
Posts: 1,048
Reputation: 359
Default AW: Memory access plugin

I appreciate all of your comments related to this release.
As a mod actually deleted this whole thread earlier, I have to say that THIS plugin is not going to hack memory of your servers. By deleting this post means to handle releases such as for example y_malloc as an evil hacking tool. y_malloc gives you the same functionalities, but this plugin might be slightly faster ( see speed comparison )

@leonardo1434 Did it compile without editing you anything inside the source code itself?
I'll add your binary once I am online at my computer again, of course.
BigETI is offline   Reply With Quote
Old 17/07/2013, 05:21 AM   #9
leonardo1434
High-roller
 
leonardo1434's Avatar
 
Join Date: Mar 2012
Posts: 1,669
Reputation: 179
Default Re: AW: Memory access plugin

Quote:
Originally Posted by BigETI View Post
I appreciate all of your comments related to this release.
As a mod actually deleted this whole thread earlier, I have to say that THIS plugin is not going to hack memory of your servers. By deleting this post means to handle releases such as for example y_malloc as an evil hacking tool. y_malloc gives you the same functionalities, but this plugin might be slightly faster ( see speed comparison )

@leonardo1434 Did it compile without editing you anything inside the source code itself?
I'll add your binary once I am online at my computer again, of course.
No exactly, i had to fix the includes. But, the main code is the same, since i didn't found any windows specific features.

@Small fix at your context.

Quote:
You have just lost the reference to the dynamicly allocated memory. This memory still exists, but it becomes totally useless, unless you've restarted your machine manually.
It's a little bit wrong, After the SAMP-Server is closed the OS itself will claim all the memory back. All it can lead is a memory leak.
__________________
c++

Last edited by leonardo1434; 17/07/2013 at 07:05 AM.
leonardo1434 is offline   Reply With Quote
Old 17/07/2013, 07:30 AM   #10
RajatPawar
High-roller
 
RajatPawar's Avatar
 
Join Date: Aug 2011
Location: ヽ༼ຈل͜ຈ༽ノ
Posts: 2,180
Reputation: 311
Default Re: Memory access plugin

Nice! I would love to try and create a linked list using this! I can think of so many applications of that in the SA-MP world.
RajatPawar 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
Invalid memory access Julian12345 Server Support 8 04/04/2014 10:29 PM
Invalid memory access audriuxxx Scripting Help 1 11/05/2013 10:04 AM
How much random access memory Manowar Scripting Help 5 05/03/2013 08:47 AM
Invalid memory access Littl3j0hNy Scripting Help 5 03/12/2011 04:51 PM
Invalid memory access wouter0100 Scripting Help 4 18/09/2011 12:28 AM


All times are GMT. The time now is 08:53 PM.


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