rayzrdev / SharpBot

A Discord.js selfbot written by Rayzr - 60 second installation!
https://git.io/sharpbot
MIT License
129 stars 134 forks source link

delete this mem leak #78

Closed ghost closed 7 years ago

ghost commented 7 years ago

kthxbai

if you really want to keep this you better use only 1 module snekfetch and make all requests yourself and as this is bloatware that takes memory and i hate this each user i see using selfbot is 99% sharpbot

tilda commented 7 years ago

following up: looking for any dependencies on specific modules (superagent, etc) dunno what the replacements are for these picky modules but I may just remove them personally as I don't use the commands that the module is meant to be used for.

yonilerner commented 7 years ago

There is an ongoing project to limit the number of dependencies and move a lot of the commands that many people wont use into separate projects as plugins.

That being said, you should get your terms straight, @Hakase-professor. A project with a lot of dependencies isnt a "mem leak". In any sense of the term. Thanks for your eloquent input though.

tilda commented 7 years ago

follow up 2: found around ~4 deps who depend on superagent also around 4 use request.

rayzr522 commented 7 years ago

And on another note, this is actually quite light on memory usage. I don't really know where you're getting your information. If you have some specific CPU/RAM numbers that you'd like to share with us, that's fine, but claiming this is "bloatware" is quite untrue.

tilda commented 7 years ago

I have around ~65 guilds and the bot uses around 430MB according to pm2

rayzr522 commented 7 years ago

The problem is not guilds itself, but the number of users.

tilda commented 7 years ago

Ah, well is it just a fault in the way that d.js handles users?

rayzr522 commented 7 years ago

Where else is it going to store them other than in-memory?

yonilerner commented 7 years ago

Discord.js caches users: https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=users

~I think whenever a user is demanded for whatever reason, lets say a message is captured, and it was sent by someone, so that user is loaded and gets inserted into the cache. I wonder if theres a way to configure Discord.js to not cache users, in which case all user fetching would have to be done asynchronously by Client#fetchUser instead of Client.users#get.~

yonilerner commented 7 years ago

Also related to what I mentioned: https://github.com/hydrabolt/discord.js/issues/1409

rayzr522 commented 7 years ago

You can only use Client#fetchUser on a bot account.

yonilerner commented 7 years ago

Good point. RIP

tilda commented 7 years ago

By the way, this should probably be marked as "discussion"

ghost commented 7 years ago

yea users caching has nothing to do with this. I have made my own selfbot that has over 200k users and it uses less than 30MB

unless this selfbot that is bloatware somehow stores and uses them for something

rayzr522 commented 7 years ago

We don't cache anything ourselves. The bot is not bloatware. None of the manager systems use any noticeable amount of RAM if any. This is not bloatware. Feel free to go find someone else's software to needlessly insult.

Again, if you are having a legitimate problem and have some real information to share, we might be able to help.

rayzr522 commented 7 years ago

I have one last comment to make, and then I'm closing this issue for good (unless someone else has anything useful to say).

You claim that you have a selfbot running in 200k users and that it uses less than 30MB? That simply isn't possible unless those servers are massively inactive, which would lead to almost nothing being cached. Another possibility is that you're clearing the caches. Discord.js caches things, and it does use RAM. If you had 200k users and they were all active, your bot would be using obscene amounts of memory.

This bot is not a memory leak. This bot is doing nothing malicious. Inspect the code yourself, if you want.