Page MenuHome

Factory default memory cache limit is 4096 MB (32bit builds)
Closed, ResolvedPublic

Description

System Information
Operating system: Microsoft Windows 7
GPU: ASUS Strix Radeon Vega 64
CPU: Intel(R) Core(TM) i7-5960X
RAM: 32.0 GB
Full System Information: Here

Blender Version

Broken: 2.80, blender-2.80.0-git.513b71c89ad0-windows32
Worked: 2.79b

Short description of error
The Factory Default memory cache limit is 4GB, but the maximum a user can input is 2GB. This causes a crash.

Exact steps for others to reproduce the error

  1. 4096
    • Start Blender with --debug --factory-startup
  1. The crash
    • Start Blender with --factory-startup
    • Load a video in MCE or VSE
    • Let the video cache
    • Once over 2GB Blender should crash

Call back:

Mapalloc returns null, fallback to regular malloc: len=8294400 in imb_addrectImBuf, total 3177326980
Calloc returns null: len=8294400 in imb_addrectImBuf, total 3192883820

Event Timeline

Philipp Oeser (lichtwerk) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.Apr 29 2019, 4:10 PM

Cannot reproduce here (linux fedora 29, 16GB RAM).

This is my RAM starting with a limit of 1GB, then increasing to 4GB, then to 8GB [all in the MCE prefetching frames] -- no crash

Seeing you are using a 32bit build, does this happen with a 64bit build? [are you limited to using 32bit builds?]

Christopher_Anderssarian raised the priority of this task from Needs Information from User to Needs Triage by Developer.Apr 29 2019, 4:50 PM

Hmm, I just tried with blender-2.80-337cac760ba9-linux-glibc224-i686 on my Ubuntu VM and I got a crash...

Did you try with a 32-bit build on your end?

Are you limited to using 32bit builds?

Nope, I choose to test them 'cause otherwise they don't get the same love their bigger sibling gets.

Sebastian Parborg (zeddb) lowered the priority of this task from Needs Triage by Developer to Normal.Apr 29 2019, 6:54 PM
Philipp Oeser (lichtwerk) triaged this task as Needs Information from User priority.Apr 30 2019, 9:04 AM

Not 100% sure, but if this is not a problem with 64bit builds and only happens on 32bit builds, then I guess this is expected?
(always had the assumption that those cannot allocate more then 2GB per process?)

Or are we talking about the fact that a limit over 2GB shouldnt be allowed on those systems?

Philipp Oeser (lichtwerk) renamed this task from Factory default memory cache limit is 4096 MB to Factory default memory cache limit is 4096 MB (32bit builds).Apr 30 2019, 9:05 AM
Christopher_Anderssarian raised the priority of this task from Needs Information from User to Waiting for Developer to Reproduce.Apr 30 2019, 9:39 AM

Not 100% sure, but if this is not a problem with 64bit builds and only happens on 32bit builds, then I guess this is expected?

It doesn't sound like you've tested it.

The maximum you can have in 2.79 is 1GB
The default in 2.79 is 1GB

The maximum a user can enter in 2.80 is 2GB
The default in 2.80 is 4GB

Or are we talking about the fact that a limit over 2GB shouldn't be allowed on those systems?

Yes

Philipp Oeser (lichtwerk) lowered the priority of this task from Waiting for Developer to Reproduce to Normal.

Thx for getting back.
Yes, this crashes in 32bit blender.

As you say the range you can put in is sort of covered by max_memory_in_megabytes_int() but the default is above that [in 32bit blender]

@Sergey Sharybin (sergey): should we check for this [use max_memory_in_megabytes_int] in BLO_update_defaults_userpref_blend (where U.memcachelimit default is set?)

Technically, there is a mistake in max_memory_in_megabytes_int(), because 32bit process can address up to 4GB of memory (even on Windows, since we do use /LARGEADDRESSAWARE).

So the reason of a crash is coming from the fact, that some other areas of Blender also allocate memory, so movie cache can not use the entire 4GB, and eventually will crash with out of memory error.

Limiting cache to 2GB for 32bit platforms seems artificial: if one simply opens an image sequence, that almost halves possible memory for a cache (because such usecase could use almost all 4GB).

Also, even with the original 2GB limit, if the geometry used 2GB, and on top of than movie cache wants to use 2GB you'll also get a crash. Similar crash will also happen on 64bit platforms, if the physical amount of memory is less than cache size (or when the memory is spent on geometry).

Not sure, probably is better to use lower value by default, and allow users to increase it higher than 2GB but below 4GB manually? That way we at least avoid a lot of crashes in a default configuration. @Brecht Van Lommel (brecht)?

Decreasing it to 2GB by default on 32 bit seems like a reasonable solution. Or min(system_memory()/2, 4GB).

I can still crash Blender with: blender-2.80.0-git.3022dd2b27fd-windows32 just by filling the MCE cache.
New report?

The change only affects default startup and does not have affect when you have user preferences saved already.
Does loading factory settings change the cache limit to 2GB?

Does loading factory settings change the cache limit to 2GB?

Yes it does.
I always test with --factory-startup.
It shows 2048MB in the settings, but goes above that with the prefetch. (once over 3GB it crashes)
If you manually input 2048MB then it's fine, just factory startup doesn't seem to apply the limit...