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

时间:2016-02-14 20:52:07

标签: c# visual-studio memory visual-studio-2015

我刚刚在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)
    {

    }
}

}

2 个答案:

答案 0 :(得分:2)

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

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

除非您提供更多代码进行测试/调试,否则我发现这与您的问题有关。

  

要立即解决此问题,请与Microsoft客户联系   支持服务以获取此修补程序。有关的完整列表   Microsoft客户支持服务电话号码和信息   关于支持费用,请访问以下Microsoft网站:   http://support.microsoft.com/contactus/?ws=support

答案 1 :(得分:0)

我知道我参加这里的聚会迟到了。 但是我通过强制构建 x64 解决了这个问题,使用构建 x84 我在我的程序中抛出了相同的异常。 程序是关于图像处理的。