• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: VWR-733
Type: New Feature New Feature
Status: Closed Closed
Resolution: Won't Finish
Priority: Major Major
Assignee: Unassigned
Reporter: Nicholaz Beresford
Votes: 14
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
1. Second Life Viewer - VWR

Change Request: Excess texture buffer memory size resulting in disk thrashing/crashes/virt memory swapping

Created: 14/May/07 10:46 AM   Updated: 30/Nov/07 07:20 AM
Return to search
Component/s: Performance
Affects Version/s: 1.15.0.x, 1.15.1.x
Fix Version/s: None

File Attachments: 1. Text File 0733_llviewerimage_1_18.patch (4 kB)
2. Text File 733_llviewerimage_cpp.patch (4 kB)
3. Text File llviewerimage.cpp (35 kB)
4. File llviewerimage_patch (3 kB)
5. File llviewerimage_patch_updated (4 kB)

Environment: All Platforms, Systems with limited physical memory (512 MB)
Issue Links:
Duplicate
 
Relates

Source Version: 1.15.1.3
Linden Lab Issue ID: SL-46270


 Description  « Hide

When researching the source and behavior of the viewer around the memory leak issue (https://jira.secondlife.com/browse/VWR-364) I found that the intended memory consumption of the client tends to be on the high side on medium and upper class graphics boards in systems with limited memory.

To understand the issue, it is necessary to understand memory use in the client.
1) an average XP installation without too much stuff in the background requires about 250 MB ram in itself
2) The SL client itself uses about 200-250MB (not counting the texture buffer)
3) The client also allocates a texture buffer based on the video ram setting (adv. graphics settings).

The buffer size (3) varies, but can go up to 650MB on a vid. board with 512MB memory, is about 350MB on my system if set to 256MB vid. memory and still is 170MB when setting vid. memory to 128MB.

The source does limit the texture buffer size depending on the amount of RAM in the system, but I think this allows for texture buffers way too big, because the texture buffer size is maxram - 128MB. That mean, on a 512MB RAM system with a 256MB vid ram board the program will use a texture buffer that gives SL.exe alone a memory footprint of about 700MB and 500MB total memory usage with a 128MB card, which will both result in excess swapping because there'll be no more room for the operating system.

My suggestion is to change

const S32 min_non_tex_system_mem = (128<<20); // 128 MB

in llviewerimage.cpp to

const S32 min_non_tex_system_mem = (128<<21); // 256 MB

to limit the texture buffer to a realistic value on 512 MB systems, thus leaving more room for the program itself and the operating system (the same goes for 1GB systems with a 512MB video board setting).

I have heard a lot of people with 512MB systems complain about disk thrashing (virt memory) and was surprised myself even to see SL.exe climb to a 1GB footprint on my system (512MB vid memory, 1.5GB RAM). Also, many people on the other thread (memory leak) were using high end graphics boards (NVIDIA 7800/8800 and up) which may make the memory use they observed normal (i.e. "as designed").

I think an excess texture buffer, which I think is intended in speeding up things (sort of a RAM cache for textures) will actually degrade performance if it results in unnecessary disk swap action, i.e. the texture buffer should be limited to a basic useful value unless it's clear that there is plenty and enough pysical memory available which is not needed by the operating system and the other parts of SL.exe.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Steve Linden added a comment - 14/May/07 01:58 PM
First comment: for readability, you would want to change that value to (256<<20) for 256 MB, and even that is old school, we should change it simply to 256 * (1024*1024) for readability.

This would effectively prevent us from running on systems with < 512 MB of RAM, however it is certainly a valid argument for systems with >= 512 MB of RAM. I will go ahead and make that change in the next update.


Nicholaz Beresford added a comment - 14/May/07 02:36 PM

Steve, sloppy reading on my side ... of course 256<<20 would be better. But it was just a quick hack in the editor anyway, in fact I would suggest a more dynamic approach because even 256MB may be too little on a 1GB system as operating system and SL (except texture buffer) will realistically probably need a non_text_system_mem of about 400MB.

Thanks for looking into it.


Nicholaz Beresford added a comment - 17/May/07 04:00 PM

Steve,

I'm attaching a patch here for this problem with dynamic system memory reserve that also adreses systems with 256 MB. This obviously is not to implement as-is but probably a good starting point.

Snippet from the patch:

if (SYSMEM_EQUAL_OR_HIGHER(1024*megabytes)) // systems with 1GB and more

{ min_non_tex_system_mem= 512*megabytes; // caps tex-mem to 512MB on 1GB machines }

else
if (SYSMEM_EQUAL_OR_HIGHER(512*megabytes)) // systems with 512MB up to 1GB

{ min_non_tex_system_mem= 384*megabytes; // caps tex-mem to 128MB on 512MB machines }

else // systems with less than 512MB (256MB, 384MB, etc.)

{ min_non_tex_system_mem= 192*megabytes; // absolute minimum (caps tex-mem to 64MB on 256MB machines) }

Nicholaz Beresford added a comment - 19/May/07 06:36 AM

I have been playing around with the texture buffer and various memory sizes on a build that also has the memory leak fixed and am attaching a new patch which scales the memory size of the texture buffer in a more consistent way and also included a change as of VWR-778 (texture buffer too low for low end graphics boards)

Nicholaz Beresford added a comment - 07/Jun/07 05:07 PM

Based on 1.16.0.5 and my experiences with test users I'm now attaching the final patch for this issue as well as VWR-778 and VWR-207

Please ignore all patches except
733_llviewerimage_cpp.patch


Dzonatas Sol added a comment - 11/Jun/07 11:25 AM
The #define can be avoided and replaced with a normal definition or inline definition. I see your name in the comments of the patch, yet final patches should be made anonymous if possible. Some of the comments can be simplified to terse global or static consts.

Mart Juno added a comment - 09/Jul/07 10:24 PM
I think I am experiencing the symptoms of this issue with Windows XP, running a brand new ATI Radeon X1950 Pro IceQ3, with the latest stock Catalyst drivers from ATI's website. The card has 512mb of onboard graphics memory, and my computer has 1GB of system memory. I did have a tiny problem with this in previous viewers, after many hours of running SL, but was using a Radeon 9500 Pro then, and therefore less graphics memory etc ....

Here are some figures of what is happening to my Second Life viewer when walking into a high texture area. Just look how quickly it dies .....

TIME - 5.53 AM
GENERAL MEMORY - Secondlife.exe memory usage in Windows Task Manager - 15 Mb
PAGEFILE SIZE - 384Mb

Time - 5.57 AM
GENERAL MEMORY - Secondlife.exe memory usage in Windows Task Manager - 180 Mb
PAGEFILE SIZE - 1250 Mb

Time - 6.00 AM
GENERAL MEMORY - Secondlife.exe memory usage in Windows Task Manager - 144 Mb
PAGEFILE SIZE - 1430 Mb


Mart Juno added a comment - 09/Jul/07 10:28 PM
This is the client that I am running. The brand new one ....

Second Life 1.17.3 (1) Jul 9 2007 15:23:37 (Second Life Release)

You are at 261188.1, 235049.3, 53.2 in Whitlow located at sim4410.agni.lindenlab.com (63.210.158.60:13006)

CPU: Intel Pentium 4 (Unknown model) (3060 MHz)
Memory: 1024 MB
OS Version: Microsoft Windows XP Service Pack 2 (Build 2600)
Graphics Card Vendor: ATI Technologies Inc.
Graphics Card: Radeon X1950 Pro x86/SSE2
OpenGL Version: 2.0.6458 WinXP Release
LLMozLib Version: 1.1.0 (Mozilla GRE:1.8.0.12_0000000000)
Packets Lost: 1/59822 (0.0%)


Nicholaz Beresford added a comment - 10/Jul/07 12:05 AM
Mart,

in the task manager look at the VM Size not RAM Size for the secondlife.exe process. This will be the more relevant value.

And on a 1GB machine, set preferences, advanced-graphics, video memory to 128 MB (or 256MB).


Seg Baphomet added a comment - 28/Jul/07 06:58 PM
This patch helps reduce swapping quite a bit, but the implementation seems more complex than necessary, to the point I can't quite wrap my sleep deprived brain around it. Could you simplify it all down to a single linear function or something?

Nicholaz Beresford added a comment - 29/Jul/07 07:04 AM

By popular demand here a current version 0733_llviewerimage_1_18.patch of the patch.

I have tried to clarify and streamline the comments a bit. Essentially what it does is to tweak the upper and lower limits of the memory texture chache to not create it with a size too small (resulting in blurry textures) or too large (causing disk swap).


Seg Baphomet added a comment - 07/Aug/07 02:07 PM
I should note that I've only been able to test this on systems with 64mb vram and 512mb RAM, my systems with better video cards and more RAM are currently rather allergic to SL, driver problems. ;P

Steve Linden added a comment - 14/Aug/07 11:55 AM

Steve Linden added a comment - 14/Aug/07 11:57 AM
See VWR-2161 for a better solution to this.