Moderators IIYAMA Posted November 14, 2012 Moderators Share Posted November 14, 2012 Hey I got a question. A friend told me onces that if you start a resource, the code(+ everything else) will be loaded in the RAM memory and it will be out of the RAM untill you stop the whole server? Is this True or False? Link to comment
AeroXbird Posted November 15, 2012 Share Posted November 15, 2012 This is correct. All code will be loaded in the memory, this is done because RAM is about 30x faster then your average HDD. Also this is the reason why you have to restart a resource to load in new scripts The images and stuff also load in memory, but only for clients. Link to comment
Renkon Posted November 15, 2012 Share Posted November 15, 2012 LoadString loads in the same way, BUT... ¿If you stop the resource, how do you unload the loadstring? Link to comment
Moderators IIYAMA Posted November 15, 2012 Author Moderators Share Posted November 15, 2012 How much lagg will a started and stopped resource cause with more than 1400 lines? Because on my pc I have an overkill on (32gb ram), the server does only have 1 gb ram. Link to comment
AeroXbird Posted November 15, 2012 Share Posted November 15, 2012 How much lagg will a started and stopped resource cause with more than 1400 lines?Because on my pc I have an overkill on (32gb ram), the server does only have 1 gb ram. That kind of resource wont even cause a little dent of lag. You will start to notice lag when restarting your resources when you have large files and 50.000+ lines of code. Link to comment
Moderators IIYAMA Posted November 15, 2012 Author Moderators Share Posted November 15, 2012 When I run this resource for real(not start and stop) It will calculate the distance between bullet inpacts that hits cars or ped/players.(only when they hit) The x y z coordinations + attacker + timestamps + mathfloor x y coordinations of the attacker. Link to comment
Anderl Posted November 15, 2012 Share Posted November 15, 2012 LoadString loads in the same way, BUT...¿If you stop the resource, how do you unload the loadstring? Wrappers, environments ( you can use Lua's setfenv or make your own environment "system" ) and unicorns. Link to comment
Renkon Posted November 15, 2012 Share Posted November 15, 2012 Do you know where can I find some example? Link to comment
Anderl Posted November 15, 2012 Share Posted November 15, 2012 Do you know where can I find some example? I doubt there's any. But what should be made is: create wrappers for functions that needs something stored and that thing should be removed when resource is stopped on an environment ( could be a table - with some modifications ) and then run loadstring on that environment. When you needed to remove things you just needed to delete things stored in any table inside the environment where things were saved. It's not hard. Link to comment
arezu Posted November 16, 2012 Share Posted November 16, 2012 If you stop the resource, how do you unload the loadstring? Things you have done with loadstring unloads automatically when you stop the resource that used it. Link to comment
Anderl Posted November 16, 2012 Share Posted November 16, 2012 (edited) If you stop the resource, how do you unload the loadstring? Things you have done with loadstring unloads automatically when you stop the resource that used it. Hell, I didn't remember that resource code is saved in a new Lua state. If for some weird reason you need to unload some code while scripts still runs, my idea will still do the trick ( actually, it was qaisjp's idea for my download manager ). Edited November 17, 2012 by Guest Link to comment
Renkon Posted November 16, 2012 Share Posted November 16, 2012 Indeed I don't really get it well without a clear example . I wanted to know how to unload since that's the perfect way to make maps with scripts be added to the server w/o starting. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now