mirror of https://github.com/PCSX2/pcsx2.git
GSdx:
Fix the worst memory leaks on emulator suspends. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3063 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
ef5124e6d3
commit
d09c269d17
|
@ -137,12 +137,10 @@ EXPORT_C GSclose()
|
||||||
{
|
{
|
||||||
if( !s_gs ) return;
|
if( !s_gs ) return;
|
||||||
|
|
||||||
s_gs->ResetDevice();
|
|
||||||
|
|
||||||
delete s_gs->m_dev;
|
|
||||||
s_gs->m_dev = NULL;
|
|
||||||
|
|
||||||
s_gs->m_wnd.Detach();
|
s_gs->m_wnd.Detach();
|
||||||
|
|
||||||
|
delete s_gs;
|
||||||
|
s_gs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT32 _GSopen(void* dsp, char* title, int renderer)
|
static INT32 _GSopen(void* dsp, char* title, int renderer)
|
||||||
|
@ -158,16 +156,6 @@ static INT32 _GSopen(void* dsp, char* title, int renderer)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (s_renderer != renderer)
|
|
||||||
{
|
|
||||||
// Emulator has made a render change request, which requires a completely
|
|
||||||
// new s_gs -- if the emu doesn't save/restore the GS state across this
|
|
||||||
// GSopen call then they'll get corrupted graphics, but that's not my problem.
|
|
||||||
|
|
||||||
delete s_gs;
|
|
||||||
s_gs = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(renderer)
|
switch(renderer)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -245,6 +233,7 @@ static INT32 _GSopen(void* dsp, char* title, int renderer)
|
||||||
|
|
||||||
EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags )
|
EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags )
|
||||||
{
|
{
|
||||||
|
GSclose();
|
||||||
int renderer = theApp.GetConfig("renderer", 0);
|
int renderer = theApp.GetConfig("renderer", 0);
|
||||||
if( flags & 4 )
|
if( flags & 4 )
|
||||||
{
|
{
|
||||||
|
@ -261,6 +250,7 @@ EXPORT_C_(INT32) GSopen2( void* dsp, INT32 flags )
|
||||||
|
|
||||||
EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
|
EXPORT_C_(INT32) GSopen(void* dsp, char* title, int mt)
|
||||||
{
|
{
|
||||||
|
GSclose();
|
||||||
int renderer;
|
int renderer;
|
||||||
|
|
||||||
// Legacy GUI expects to acquire vsync from the configuration files.
|
// Legacy GUI expects to acquire vsync from the configuration files.
|
||||||
|
|
|
@ -44,7 +44,7 @@ GSDevice::GSDevice()
|
||||||
GSDevice::~GSDevice()
|
GSDevice::~GSDevice()
|
||||||
{
|
{
|
||||||
for_each(m_pool.begin(), m_pool.end(), delete_object());
|
for_each(m_pool.begin(), m_pool.end(), delete_object());
|
||||||
|
m_pool.clear();
|
||||||
delete m_backbuffer;
|
delete m_backbuffer;
|
||||||
delete m_merge;
|
delete m_merge;
|
||||||
delete m_weavebob;
|
delete m_weavebob;
|
||||||
|
|
|
@ -52,15 +52,13 @@ GSRenderer::GSRenderer()
|
||||||
|
|
||||||
GSRenderer::~GSRenderer()
|
GSRenderer::~GSRenderer()
|
||||||
{
|
{
|
||||||
/*if(m_dev)
|
if(m_dev)
|
||||||
{
|
{
|
||||||
m_dev->Reset(1, 1, GSDevice::Windowed);
|
m_dev->Reset(1, 1);
|
||||||
}*/
|
|
||||||
|
|
||||||
_aligned_free( m_tex_buff );
|
|
||||||
|
|
||||||
delete m_dev;
|
delete m_dev;
|
||||||
}
|
}
|
||||||
|
_aligned_free( m_tex_buff );
|
||||||
|
}
|
||||||
|
|
||||||
bool GSRenderer::CreateWnd(const string& title, int w, int h)
|
bool GSRenderer::CreateWnd(const string& title, int w, int h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -455,7 +455,7 @@ protected:
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
// TODO: GSreset can come from the main thread too => crash
|
// TODO: GSreset can come from the main thread too => crash
|
||||||
// m_tc->RemoveAll();
|
m_tc->RemoveAll();
|
||||||
|
|
||||||
m_reset = true;
|
m_reset = true;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ class GSTexture11 : public GSTexture
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GSTexture11(ID3D11Texture2D* texture);
|
explicit GSTexture11(ID3D11Texture2D* texture);
|
||||||
|
virtual ~GSTexture11() {};
|
||||||
|
|
||||||
bool Update(const GSVector4i& r, const void* data, int pitch);
|
bool Update(const GSVector4i& r, const void* data, int pitch);
|
||||||
bool Map(GSMap& m, const GSVector4i* r);
|
bool Map(GSMap& m, const GSVector4i* r);
|
||||||
|
|
|
@ -32,5 +32,6 @@ protected:
|
||||||
void Read(Target* t, const GSVector4i& r);
|
void Read(Target* t, const GSVector4i& r);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual ~GSTextureCache11() {};
|
||||||
GSTextureCache11(GSRenderer* r);
|
GSTextureCache11(GSRenderer* r);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue