Expression Encoder

The team blog for Expression Encoder.

March, 2010

  • Expression Encoder

    Maximizing your memory usage of your application based on the Expression Encoder SDK


    Fact 1: Currently, our SDK is 32-bit only due to a lot of our dependencies. This brings a few limitations, including a theoretical memory usage limit of 4GB. But because of complex OS memory usage rules, compiled 32-bit applications are limited to access only 2GB by default (this is true on both running on a 32-bit OS or a 64-bit OS via WOW64).


    Fact 2: Encoding video, especially when using HD sources and/or encoding to SmoothStreaming, requires loads of memory. In fact, some encoding operations requires so much memory that our encoding pipeline has to reduce the number of concurrent encoding streams because it's starving memory-wise.


    Fact 3: Memory is much cheaper, with some <$1000 PCs having 12GB of RAM. Concurrently, the 64-bit Windows OS market share has never been higher and users are successfully running their 32-bit applications via Wow64.


    Until Expression Encoder is available in a 64-bit flavor, that 2GB limitation will be a serious bottleneck affecting performance on custom applications using the Encoder SDK.


    Is there a way to mitigate that 2GB memory limit on a 32bit application? In a word: yes.


    For a Native application, you can use the "/LARGEADDRESSAWARE" linker flag, which will let a 32-bit application running on a 64-bit OS allocate up to 2GB of extra user-mode memory, effectively doubling the usable memory and therefore removing some of that bottleneck. And while that flag never got ported to the managed linker, you can also achieve the same result by doing this post-link operation:


    EditBin.exe /LARGEADDRESSAWARE C:\...\bin\Debug\<YourApplication>.exe


    Unfortunately, it’s a little more complicated to take advantage of this extra memory on a 32-bit based OS, as it does involve adding a boot flag ("/3GB") to reduce the kernel memory allocation in favor of user-mode memory, which will provide up to an extra 1GB to applications. But it comes at a price and should be avoided on XP since it may affect system stability because of some GPU memory mapping. A lot more information on this subect is available on those 2 pages:


    It's worth noting that the “/LARGEADDRESSAWARE” flag will simply be ignored on a 32-bit OS if the “/3GB” boot flag isn’t set, so there are no drawbacks in modifying your app with EditBin as explained above.


    Please also note that we already did this operation on the Encoder GUI (EncoderUI.exe) for our users’ convenience, but that step will be required if you want your custom application using the Encoder SDK to be able to use more than 2GB of memory.


    Here is a good blog entry with more details on this topic:

Page 1 of 1 (1 items)