Jon Davis said:
You continue to make some pretty blanket pronouncements about this not
being usable on a server. Have you ever heard of a queue?!
Jon
When I'm talking about "server side" I mean within a "service process"
running on a Server , don't know what queue you mean here though, but if
you think about queuing requests to another service using some IPC
mechanism, the problem remains the same, that service needs to handle all
WPF stuff from a STA thread. Just face it, WPF is client side technology in
V3, just like WIndows.Forms (which is not supported server side!) is in V2,
both are designed to be used from a interactive session running a desktop
like application.
The presentationcore and presentationframework managed libraries libraries,
do load the DWM (Destop Window Manager), the MIL 5Media Integration Layer)
the codecs (windowscodesc.dll) library and a couple of other native
libraries, a number of these libraries are loaded in the middle of the
Virtual address space, cutting the free space available for the GC heap in
pieces (fragmentation!), that means that the largest contiguous space is
less than 500MB on 32 bit Windows. But there is more, it loads also GDI and
USER32, and consumes GDI handles and USER objects and uses extra memory from
both the paged and non paged pooled memory pages, these resources are quite
expensive, on anything lower than Vista, the non paged pool space is shared
among all sessions (interactive or not), on Vista, services run in Session
0, and here this space is even more restricted (Services should not have
UI's on Vista, that is - should not hold into HWND's, should not require
space for the clipboard etc...).
And this whole stuff needs an STA to run in, when used in a service context
like ASP.NET it means that it doesn't scale, this is nothing new, this is
one of the reason asp.net was invented and STA threading abandoned in this
context (aspcompat is for backwards compatibility). Also, the memory
footprint is way to large, your simple sample consumes from ~70MB up to
~135MB committed private bytes (the console version) , this quite some
memory just to render (a nearly empty) XAML as jpeg.
Anyway, if you think you can use this "server side", I won't stop you, but I
won't do it, nor will I ever suggest this as possible solution for the
problem at hand, when I need to render something like this, I will simply
call the windowscodecs library (WIC) from unmanaged code or from mixed mode
C++/CLI code.
Willy.