diff options
author | Jacek Antonelli | 2009-06-13 13:17:14 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-06-13 13:17:20 -0500 |
commit | 0517fe4322443bdc317f8185590a63134e3f8394 (patch) | |
tree | 942c9c26d0792accc928010a113d123c5409659b /linden/indra/newview/llappviewerwin32.cpp | |
parent | Second Life viewer sources 1.23.2-RC (diff) | |
download | meta-impy-0517fe4322443bdc317f8185590a63134e3f8394.zip meta-impy-0517fe4322443bdc317f8185590a63134e3f8394.tar.gz meta-impy-0517fe4322443bdc317f8185590a63134e3f8394.tar.bz2 meta-impy-0517fe4322443bdc317f8185590a63134e3f8394.tar.xz |
Second Life viewer sources 1.23.3-RC
Diffstat (limited to 'linden/indra/newview/llappviewerwin32.cpp')
-rw-r--r-- | linden/indra/newview/llappviewerwin32.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/linden/indra/newview/llappviewerwin32.cpp b/linden/indra/newview/llappviewerwin32.cpp index 1692892..7a8d486 100644 --- a/linden/indra/newview/llappviewerwin32.cpp +++ b/linden/indra/newview/llappviewerwin32.cpp | |||
@@ -159,9 +159,31 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, | |||
159 | int nCmdShow) | 159 | int nCmdShow) |
160 | { | 160 | { |
161 | LLMemType mt1(LLMemType::MTYPE_STARTUP); | 161 | LLMemType mt1(LLMemType::MTYPE_STARTUP); |
162 | |||
163 | const S32 MAX_HEAPS = 255; | ||
164 | DWORD heap_enable_lfh_error[MAX_HEAPS]; | ||
165 | S32 num_heaps = 0; | ||
162 | 166 | ||
163 | #if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD | 167 | #if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD |
164 | _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit | 168 | _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit |
169 | #elif 1 | ||
170 | // Experimental - enable the low fragmentation heap | ||
171 | // This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations) | ||
172 | // Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1 | ||
173 | |||
174 | _CrtSetDbgFlag(0); // default, just making explicit | ||
175 | |||
176 | ULONG ulEnableLFH = 2; | ||
177 | HANDLE* hHeaps = new HANDLE[MAX_HEAPS]; | ||
178 | num_heaps = GetProcessHeaps(MAX_HEAPS, hHeaps); | ||
179 | for(S32 i = 0; i < num_heaps; i++) | ||
180 | { | ||
181 | bool success = HeapSetInformation(hHeaps[i], HeapCompatibilityInformation, &ulEnableLFH, sizeof(ulEnableLFH)); | ||
182 | if (success) | ||
183 | heap_enable_lfh_error[i] = 0; | ||
184 | else | ||
185 | heap_enable_lfh_error[i] = GetLastError(); | ||
186 | } | ||
165 | #endif | 187 | #endif |
166 | 188 | ||
167 | // *FIX: global | 189 | // *FIX: global |
@@ -183,8 +205,21 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, | |||
183 | llwarns << "Application init failed." << llendl; | 205 | llwarns << "Application init failed." << llendl; |
184 | return -1; | 206 | return -1; |
185 | } | 207 | } |
186 | 208 | ||
187 | // Run the application main loop | 209 | // Have to wait until after logging is initialized to display LFH info |
210 | if (num_heaps > 0) | ||
211 | { | ||
212 | llinfos << "Attempted to enable LFH for " << num_heaps << " heaps." << llendl; | ||
213 | for(S32 i = 0; i < num_heaps; i++) | ||
214 | { | ||
215 | if (heap_enable_lfh_error[i]) | ||
216 | { | ||
217 | llinfos << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << llendl; | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | |||
222 | // Run the application main loop | ||
188 | if(!LLApp::isQuitting()) | 223 | if(!LLApp::isQuitting()) |
189 | { | 224 | { |
190 | viewer_app_ptr->mainLoop(); | 225 | viewer_app_ptr->mainLoop(); |