Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

One DLL - Two apps?

0 views
Skip to first unread message

F Vicaria

unread,
Sep 4, 2003, 1:56:33 PM9/4/03
to

Is it possible to have 2 .NET applications sharing the same .NET DLL in
memory?
Meaning I don't want each app to have its own copy (and the DLL is a .NET
dll).

Thanks.

--

Regards,
Fernando

"Tell me and I will forget; show me and I may remember; involve me and I
will understand."
- Chinese Proverb


Anthony Moore

unread,
Sep 5, 2003, 7:52:31 PM9/5/03
to
This question seems to be asking the question: what is the memory usage
when the same DLL is loaded by multiple Procesess.

Well, firstly, in terms of actual DLL data, such as static fields, you
actually get a different copy of these per App-Domain. This means that it
is not possible to have two Processes sharing the same set of static
fields, even if the classes come from the same DLL. It also means that it
is possible to have multiple sets of static data in the same Process, but
that is another story.

Now, what about the code? By default the DLL code will get Just-In-Time
compiled in a way that is optimized for the way the DLL is being used. This
means that it only compiles the methods that are actually getting called.
Also, code may be optimized differently depending on the configuration and
security settings of the application calling. However, a consequence of
this is that the JITTED code cannot be safely shared by two processes, and
this will be duplicated.

There is another way to handle dynamic compliltion called NGEN. There is a
tool called NGEN.EXE that can be used to "pre-JIT" a DLL. If you do this,
the code is compiled once and saved in a special cache, and this can be
shared by multiple processes. The code is marginally slower, although the
startup time of the application using it is generally faster. Search for
NGEN on MSDN to find out more.


--------------------
| Reply-To: "F Vicaria" <fvic...@hotmail.com>
| From: "F Vicaria" <fvic...@hotmail.com>
| Subject: One DLL - Two apps?
| Date: Thu, 4 Sep 2003 10:56:33 -0700
| Lines: 18
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uTHQj3wc...@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.clr
| NNTP-Posting-Host: host143186050011.borland.com 143.186.50.11
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.clr:7890
| X-Tomcat-NG: microsoft.public.dotnet.framework.clr

F Vicaria

unread,
Sep 9, 2003, 7:20:51 PM9/9/03
to
Thanks for the explanation Anthony....
The main reason I ask is because we are trying to automate some of our IDE
tests and this seemed to be a good approach at the time.

Best regard,
Fernando

"Anthony Moore" <amo...@online.microsoft.com> wrote in message
news:XGtFKjA...@cpmsftngxa06.phx.gbl...

0 new messages