c# - 内存不足,无法继续执行程序 VisualStudio

我刚刚在 c# .net 中制作了一个程序,现在当我尝试保存或调试它时,我在消息框中收到此错误。这是我目前为我的项目编写的代码。错误代码“内存不足,无法继续执行程序”请帮忙。

            if (PS3.GetCurrentAPI() == SelectAPI.ControlConsole)
            {
                MessageBox.Show("Successfully Connected To PS3", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                connectstuslbl1.Text = " Status: Connected";
                connectstuslbl1.ForeColor = Color.Green;
                PS3.CCAPI.RingBuzzer(CCAPI.BuzzerMode.Single);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Successfully Connected To PS3");
                attachButton.Enabled = true;
                disconnectButton.Enabled = false;
                MySyn.SpeakAsync(richTextBox1.Text); // read the text that inside the Rich Text Box
            }
            else if (PS3.GetCurrentAPI() == SelectAPI.TargetManager)
            {
                MessageBox.Show("Connected", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                connectstuslbl1.Text = " Status: Connected";
                connectstuslbl1.ForeColor = Color.Green;
                attachButton.Enabled = true;
                disconnectButton.Enabled = false;
                MySyn.SpeakAsync(richTextBox1.Text); // read the text that inside the Rich Text Box
            }

        }
        catch
        {
            MessageBox.Show("Something is wrong please try again :/", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            connectstuslbl1.Text = "Failed To Connect";
            connectstuslbl1.ForeColor = Color.Red;
        }
    }

    private void flatButton2_Click(object sender, EventArgs e)
    {
        try
        {
            if (!PS3.AttachProcess())//what this does is runs a error code if theres nothing there, so instead of it saying "Connected"                                             like some tools do it will say ERROR.
            {
                attachmentLabel2.Text = "Failed To Attach";
                attachmentLabel2.ForeColor = Color.Red;
                return;
            }
            if (PS3.GetCurrentAPI() == SelectAPI.ControlConsole)
            {
                PS3.CCAPI.RingBuzzer(CCAPI.BuzzerMode.Double);
            }
            attachmentLabel2.Text = "Status: Attached";
            attachmentLabel2.ForeColor = Color.Green;
            MessageBox.Show("HatedRTMtool", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            disconnectButton.Enabled = true;
            MySyn.SpeakAsync(richTextBox2.Text); // read the text that inside the Rich Text Box
        }
        catch
        {
            attachmentLabel2.Text = "Failed To Attach";
            attachmentLabel2.ForeColor = Color.Red;
            PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Failed To Attach :/");

        }
    }

    private void flatToggle1_CheckedChanged(object sender)
    {

        if (this.flatToggle1.Checked)
        {
            byte[] ON = new byte[] { 0x2C, 0x03, 0x00, 0x01 };//redbox
            PS3.SetMemory(0x1AF110, ON);
        }
        else
        {
            byte[] OFF = new byte[] { 0x2C, 0x03, 0x00, 0x00 };
            PS3.SetMemory(0x1AF110, OFF);
        }
    }

    private void flatToggle2_CheckedChanged(object sender)
    {
        if (this.flatToggle2.Checked)
        {
            byte[] ON = new byte[] { 0x6B, 0x18, 0x00, 0x00 }; //advanced uav
            PS3.SetMemory(0x1A6A98, ON);
        }
        else
        {
            byte[] OFF = new byte[] { 0x6B, 0x18, 0x00, 0x01 };
            PS3.SetMemory(0x1A6A98, OFF);
        }
    }

    private void flatToggle3_CheckedChanged(object sender)
    {
        if (this.flatToggle3.Checked)
        {
            byte[] ON = new byte[] { 0x2C, 0x12, 0x00, 0x01 };//lazer
            PS3.SetMemory(0x21B6B4, ON);
        }
        else
        {
            byte[] OFF = new byte[] { 0x2C, 0x12, 0x00, 0x00 };
            PS3.SetMemory(0x21B6B4, OFF);
        }
    }

    private void flatToggle4_CheckedChanged(object sender)
    {
        if (this.flatToggle4.Checked)
        {
            byte[] ON = new byte[] { 0x2C, 0x83, 0x00, 0x00 };//small crosshair
            PS3.SetMemory(0x187294, ON);
        }
        else
        {
            byte[] OFF = new byte[] { 0x2C, 0x83, 0x00, 0x02 };
            PS3.SetMemory(0x187294, OFF);
        }
    }

    private void flatToggle5_CheckedChanged(object sender)
    {

        if (this.flatToggle5.Checked)
        {
            byte[] ON = new byte[] { 0x60, 0x00, 0x00, 0x00 };//no recoil
            PS3.SetMemory(0x228930, ON);
        }

    }

    private void flatToggle6_CheckedChanged(object sender)
    {

        if (this.flatToggle6.Checked)
        {
            byte[] ON = new byte[] { 0x2C, 0x03, 0x00, 0x01 };//green player
            PS3.SetMemory(0x60087C, ON);
        }
        else
        {
            byte[] OFF = new byte[] { 0x2C, 0x03, 0x00, 0x00 };
            PS3.SetMemory(0x60087C, OFF);
        }
    }

    private void flatToggle7_CheckedChanged(object sender)
    {

        if (this.flatToggle7.Checked)
        {
            byte[] ON = new byte[] { 0x38, 0xC0, 0x00, 0x09 };//wall hack
            PS3.SetMemory(0x1DDBD0, ON);
        }
        else
        {
            byte[] OFF = new byte[] { 0x63, 0xE6, 0x00, 0x00 };
            PS3.SetMemory(0x1DDBD0, OFF);
        }
    }

    private void flatButton1_Click_1(object sender, EventArgs e)
    {
        byte[] bytes = BitConverter.GetBytes((int)this.flatNumeric1.Value);
        PS3.SetMemory((uint)Stats.AWPrestige, bytes); //Prestige
    }

    private void flatButton2_Click_1(object sender, EventArgs e)
    {
        byte[] buffer6 = BitConverter.GetBytes((int)this.flatNumeric2.Value);
        PS3.SetMemory((uint)Stats.AWScore, buffer6); //Score
    }

    private void flatButton10_Click(object sender, EventArgs e)
    {

        byte[] buffer289 = BitConverter.GetBytes((int)this.flatNumeric3.Value);
        PS3.SetMemory((uint)Stats.AWWins, buffer289); //Wins
    }

    private void flatButton11_Click(object sender, EventArgs e)
    {

        byte[] buffer3 = BitConverter.GetBytes((int)this.flatNumeric4.Value);
        PS3.SetMemory((uint)Stats.AWLosses, buffer3); //Losses
    }

    private void flatButton12_Click(object sender, EventArgs e)
    {
        byte[] buffer4 = BitConverter.GetBytes((int)this.flatNumeric5.Value);
        PS3.SetMemory((uint)Stats.AWKills, buffer4); //Kills
    }

    private void flatButton13_Click(object sender, EventArgs e)
    {
        byte[] buffer5 = BitConverter.GetBytes((int)this.flatNumeric6.Value);
        PS3.SetMemory((uint)Stats.AWDeaths, buffer5); //Deaths
    }

    private void flatButton14_Click(object sender, EventArgs e)
    {
        byte[] buffer7 = BitConverter.GetBytes((int)this.flatNumeric7.Value);
        PS3.SetMemory((uint)Stats.AWGamePlayed, buffer7); //Games Played  
    }

    private void flatButton8_Click(object sender, EventArgs e)
    {
        byte[] buffer8 = BitConverter.GetBytes((int)this.flatNumeric8.Value);
        PS3.SetMemory((uint)Stats.AWAccuracy, buffer8); //Accuracy
    }

    private void flatButton6_Click(object sender, EventArgs e)
    {
        flatNumeric2.Value = 3240000; //Score
        flatNumeric3.Value = 7000; //Wins    
        flatNumeric4.Value = 20000; //Losses
        flatNumeric5.Value = 30000; //Kills
        flatNumeric6.Value = 100000; //Deaths
    }

    private void flatButton7_Click(object sender, EventArgs e)
    {

    }

    private void flatButton3_Click(object sender, EventArgs e)
    {
        byte[] buffer = new byte[0x1770];
        for (int i = 0; i < 0x1770; i++)
        {
            buffer[i] = 0xfe;
        }
        PS3.SetMemory(Stats.AWUnlockAll, buffer);
    }

    private void flatButton4_Click(object sender, EventArgs e)
    {
        flatNumeric2.Value = 44046576; //Score
        flatNumeric3.Value = 17059; //Wins    
        flatNumeric4.Value = 6038; //Losses
        flatNumeric5.Value = 408940; //Kills
        flatNumeric6.Value = 152470; //Deaths
        flatNumeric1.Value = 15; //Prestige
    }

    private void flatButton5_Click(object sender, EventArgs e)
    {

        byte[] buffer = new byte[0x1770];
        for (int i = 0; i < 0x1770; i++)
        {
            buffer[i] = 0xfe;
        }
        PS3.SetMemory(Stats.AWUnlockAll, buffer);//level 50
    }

    private void flatButton7_Click_1(object sender, EventArgs e)
    {
        //time played
        byte[] buffer13 = new byte[4];
        PS3.GetMemory(Stats.AWTimePlayed, buffer13);
        int num = BitConverter.ToInt32(buffer13, 0);
        int num2 = ((num / 60) / 60) / 0x18;
        int num3 = ((num / 60) / 60) % 0x18;
        int num4 = (num / 60) % 60;
        this.flatNumeric9.Value = num2;
        this.flatNumeric10.Value = num3;
        this.flatNumeric11.Value = num4;
    }

    private void flatButton21_Click(object sender, EventArgs e)
    {
        PS3.Extension.WriteString(Stats.AWClasse1, flatTextBox1.Text);
    }

    private void flatButton16_Click(object sender, EventArgs e)
    {

    }

    private void flatButton15_Click(object sender, EventArgs e)
    {

    }

    private void flatButton17_Click(object sender, EventArgs e)
    {

    }

    private void flatButton18_Click(object sender, EventArgs e)
    {

    }

    private void flatButton19_Click(object sender, EventArgs e)
    {

    }

    private void flatButton20_Click(object sender, EventArgs e)
    {

    }

    private void flatButton22_Click(object sender, EventArgs e)
    {

    }

    private void flatButton23_Click(object sender, EventArgs e)
    {

    }

    private void flatButton24_Click(object sender, EventArgs e)
    {

    }
}

最佳答案

出现此问题是因为应用程序在每次失效更新时都会创建一个新的位图缓存,而不是更新现有缓存。

当应用程序快速使位图无效时,可能会耗尽内存资源,然后发生异常。

除非您提供更多代码来测试/调试,否则我只能找到与您的问题相关的所有代码。

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website: http://support.microsoft.com/contactus/?ws=support

https://stackoverflow.com/questions/35397851/

相关文章:

angularjs - UI-Grid 分页模板可编辑

.htaccess - 只允许通过 VPN 私有(private)访问网站

vim - tmux 将选择从复制模式发送到其他 Pane (xargs 加入?)

turing-machines - PCP 可以识别吗?

sql - Knex 原始查询不工作 postgresql

emacs - 使 Emacs/Slime/Quicklisp/SBCL 在 Windows 中工作

azure - 是 Console.ReadKey();适合 azure webjob

emacs - 在 emacs 中使用 orgtbl 在 latex 中垂直线条

ruby-on-rails - 如何连接表以仅获取 has-many 关联的最后一条记录?

asp.net-mvc - ASP.net MVC : Identity and drop auth