mirror of https://github.com/PCSX2/pcsx2.git
wxWidgets/Win32: Added a private heap allocation feature, which directs all wxString and wxObject allocations through a Windows private Heap (should reduce fragmentation and multithreaded contention when allocating/freeing blocks)
(and fix some oddball compilation errors in spu2-x in rare circumstances) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1987 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
53dd6b728a
commit
67957b13b6
|
@ -5,6 +5,7 @@
|
||||||
Name="wxBase28"
|
Name="wxBase28"
|
||||||
ProjectGUID="{48AD7E0A-25B1-4974-A1E3-03F8C438D34F}"
|
ProjectGUID="{48AD7E0A-25B1-4974-A1E3-03F8C438D34F}"
|
||||||
RootNamespace="wxBase28"
|
RootNamespace="wxBase28"
|
||||||
|
TargetFrameworkVersion="0"
|
||||||
>
|
>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
|
@ -573,6 +574,10 @@
|
||||||
RelativePath="..\..\src\msw\dlmsw.cpp"
|
RelativePath="..\..\src\msw\dlmsw.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\src\msw\HeapAllocator.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\src\msw\main.cpp"
|
RelativePath="..\..\src\msw\main.cpp"
|
||||||
>
|
>
|
||||||
|
@ -693,6 +698,10 @@
|
||||||
RelativePath="..\..\include\wx\msw\gccpriv.h"
|
RelativePath="..\..\include\wx\msw\gccpriv.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\wx\msw\HeapAllocator.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\wx\msw\libraries.h"
|
RelativePath="..\..\include\wx\msw\libraries.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
Name="wxConfig28"
|
Name="wxConfig28"
|
||||||
ProjectGUID="{C34487AF-228A-4D11-8E50-27803DF76873}"
|
ProjectGUID="{C34487AF-228A-4D11-8E50-27803DF76873}"
|
||||||
RootNamespace="wxConfig"
|
RootNamespace="wxConfig"
|
||||||
|
TargetFrameworkVersion="0"
|
||||||
>
|
>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
|
@ -126,6 +127,10 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\include\wx\setup.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\wx\msw\setup.h"
|
RelativePath="..\..\include\wx\msw\setup.h"
|
||||||
>
|
>
|
||||||
|
@ -160,10 +165,6 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\include\wx\setup.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Resource Files"
|
Name="Resource Files"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
Name="wxCore28"
|
Name="wxCore28"
|
||||||
ProjectGUID="{0318BA30-EF48-441A-9E10-DC85EFAE39F0}"
|
ProjectGUID="{0318BA30-EF48-441A-9E10-DC85EFAE39F0}"
|
||||||
RootNamespace="wxCore"
|
RootNamespace="wxCore"
|
||||||
|
TargetFrameworkVersion="0"
|
||||||
>
|
>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
|
|
|
@ -433,6 +433,40 @@ public:
|
||||||
|
|
||||||
// Turn on the correct set of new and delete operators
|
// Turn on the correct set of new and delete operators
|
||||||
|
|
||||||
|
#if wxUSE_PRIVATE_HEAP && defined(__WXMSW__)
|
||||||
|
void* operator new( size_t size, const wxChar * = NULL, int = 0 )
|
||||||
|
{
|
||||||
|
_allocateHeap_wxObject();
|
||||||
|
return _allocHeap_wxObject( size );
|
||||||
|
}
|
||||||
|
|
||||||
|
void *operator new[] ( size_t size, const wxChar * = NULL, int = 0 )
|
||||||
|
{
|
||||||
|
_allocateHeap_wxObject();
|
||||||
|
return _allocHeap_wxObject( size );
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete( void* ptr )
|
||||||
|
{
|
||||||
|
_freeHeap_wxObject( ptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete( void* ptr, const wxChar*, int )
|
||||||
|
{
|
||||||
|
_freeHeap_wxObject( ptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete[]( void* ptr )
|
||||||
|
{
|
||||||
|
_freeHeap_wxObject( ptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete[]( void* ptr, const wxChar*, int )
|
||||||
|
{
|
||||||
|
_freeHeap_wxObject( ptr );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT
|
#ifdef _WX_WANT_NEW_SIZET_WXCHAR_INT
|
||||||
void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 );
|
void *operator new ( size_t size, const wxChar *fileName = NULL, int lineNum = 0 );
|
||||||
#endif
|
#endif
|
||||||
|
@ -459,6 +493,7 @@ public:
|
||||||
|
|
||||||
#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT
|
#ifdef _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT
|
||||||
void operator delete[] (void* buf, const wxChar*, int );
|
void operator delete[] (void* buf, const wxChar*, int );
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ref counted data handling methods
|
// ref counted data handling methods
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
// Default is 0
|
// Default is 0
|
||||||
//
|
//
|
||||||
// Recommended setting: 1 if you are not using a memory debugging tool, else 0
|
// Recommended setting: 1 if you are not using a memory debugging tool, else 0
|
||||||
#define wxUSE_MEMORY_TRACING 1
|
#define wxUSE_MEMORY_TRACING 0
|
||||||
|
|
||||||
// In debug mode, cause new and delete to be redefined globally.
|
// In debug mode, cause new and delete to be redefined globally.
|
||||||
// If this causes problems (e.g. link errors which is a common problem
|
// If this causes problems (e.g. link errors which is a common problem
|
||||||
|
@ -109,6 +109,20 @@
|
||||||
// Recommended setting: 0
|
// Recommended setting: 0
|
||||||
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
#define wxUSE_DEBUG_NEW_ALWAYS 0
|
||||||
|
|
||||||
|
// [PCSX2 Extension (Win32-specific)]
|
||||||
|
// Tells wxWidgets to use private heaps for wxString and wxObject. This is very
|
||||||
|
// useful for two reasons: it tends to be a good speedup, since these objects
|
||||||
|
// allocate a lot of small blocks that fragment the global heap, and it also
|
||||||
|
// bypasses the CRT, which avoids heap pollution when looking for memory leaks.
|
||||||
|
// Typically wxWidgets is leak-free so you only want your own app's blocks in
|
||||||
|
// the global CRT heap.
|
||||||
|
//
|
||||||
|
// Default is 1.
|
||||||
|
//
|
||||||
|
// Recommended Setting: 1 (wxWidgets developers my find it useful to use 0).
|
||||||
|
//
|
||||||
|
#define wxUSE_PRIVATE_HEAP 1
|
||||||
|
|
||||||
// wxHandleFatalExceptions() may be used to catch the program faults at run
|
// wxHandleFatalExceptions() may be used to catch the program faults at run
|
||||||
// time and, instead of terminating the program with a usual GPF message box,
|
// time and, instead of terminating the program with a usual GPF message box,
|
||||||
// call the user-defined wxApp::OnFatalException() function. If you set
|
// call the user-defined wxApp::OnFatalException() function. If you set
|
||||||
|
|
|
@ -174,11 +174,18 @@ inline int Stricmp(const char *psz1, const char *psz2)
|
||||||
|
|
||||||
#include "wx/beforestd.h"
|
#include "wx/beforestd.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#if wxUSE_PRIVATE_HEAP && defined(__WXMSW__)
|
||||||
|
# include "wx/msw/HeapAllocator.h"
|
||||||
|
#endif
|
||||||
#include "wx/afterstd.h"
|
#include "wx/afterstd.h"
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
#ifdef HAVE_STD_WSTRING
|
#ifdef HAVE_STD_WSTRING
|
||||||
typedef std::wstring wxStdString;
|
#if wxUSE_PRIVATE_HEAP && defined(__WXMSW__)
|
||||||
|
typedef std::basic_string< wchar_t, std::char_traits< wchar_t >, wxStringAllocator<wchar_t> > wxStdString;
|
||||||
|
#else
|
||||||
|
//typedef std::wstring wxStdString;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
typedef std::basic_string<wxChar> wxStdString;
|
typedef std::basic_string<wxChar> wxStdString;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -282,12 +282,16 @@ bool wxEntryStart(int& argc, wxChar **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PCSX2: Dunno why my operator new overload fails to work on this. Says it needs
|
||||||
|
// one with four parameters... ?
|
||||||
|
#if !wxUSE_PRIVATE_HEAP || !defined(__WXMSW__)
|
||||||
if ( !app.get() )
|
if ( !app.get() )
|
||||||
{
|
{
|
||||||
// either IMPLEMENT_APP() was not used at all or it failed -- in any
|
// either IMPLEMENT_APP() was not used at all or it failed -- in any
|
||||||
// case we still need something
|
// case we still need something
|
||||||
app.Set(new wxDummyConsoleApp);
|
app.Set(new wxDummyConsoleApp);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// wxApp initialization: this can be customized
|
// wxApp initialization: this can be customized
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#ifndef _SPU2X_GLOBAL_H_
|
#ifndef _SPU2X_GLOBAL_H_
|
||||||
#define _SPU2X_GLOBAL_H_
|
#define _SPU2X_GLOBAL_H_
|
||||||
|
|
||||||
|
#define NOMINMAX
|
||||||
|
|
||||||
struct StereoOut16;
|
struct StereoOut16;
|
||||||
struct StereoOut32;
|
struct StereoOut32;
|
||||||
struct StereoOutFloat;
|
struct StereoOutFloat;
|
||||||
|
|
|
@ -63,7 +63,7 @@ __forceinline void Verifyc(HRESULT hr, const char* fn)
|
||||||
|
|
||||||
void AssignSliderValue( HWND idcwnd, HWND hwndDisplay, int value )
|
void AssignSliderValue( HWND idcwnd, HWND hwndDisplay, int value )
|
||||||
{
|
{
|
||||||
value = min( max( value, 0 ), 512 );
|
value = std::min( std::max( value, 0 ), 512 );
|
||||||
SendMessage(idcwnd,TBM_SETPOS,TRUE,value);
|
SendMessage(idcwnd,TBM_SETPOS,TRUE,value);
|
||||||
|
|
||||||
wchar_t tbox[32];
|
wchar_t tbox[32];
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef WINVER
|
||||||
# define WINVER 0x0501
|
# define WINVER 0x0501
|
||||||
# define _WIN32_WINNT 0x0501
|
# define _WIN32_WINNT 0x0501
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
|
Loading…
Reference in New Issue