473,785 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CLR Shared Memory, C# DLL load

DR
CLR Shared Memory, C# DLL load

How to share memory between CLR calls to the same C# dll? Is there some way
to know in the C# dll when the dll is loaded? Is the dll reloaded each tiem
a method is called from SQL Server or is the DLL loaded once when the C# dll
is added to sql server with CREATE ASSEMBLY?

I wold like to be able to share memory accross calls to methods on the same
C# dll is why. e.g. a Shared ArrayList or a shared Hashtable.
Oct 29 '07 #1
4 6499
DR,

Are you doing this in the same app domain? If so, then a static member
is all you need.

However, if you want to do this in different application domains, then
you can't use shared memory from C# (I think there is a way to do it in C++
with the CLI extensions, but I'm not sure). Rather, you would have to
create a service (not a literal one, but one instance which other app
domains communicate with) which will host the values and return them to the
callers.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"DR" <so************ *******@yahoo.c omwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
CLR Shared Memory, C# DLL load

How to share memory between CLR calls to the same C# dll? Is there some
way to know in the C# dll when the dll is loaded? Is the dll reloaded each
tiem a method is called from SQL Server or is the DLL loaded once when the
C# dll is added to sql server with CREATE ASSEMBLY?

I wold like to be able to share memory accross calls to methods on the
same C# dll is why. e.g. a Shared ArrayList or a shared Hashtable.

Oct 29 '07 #2
"DR" <so************ *******@yahoo.c omwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
CLR Shared Memory, C# DLL load

How to share memory between CLR calls to the same C# dll? Is there some
way to know in the C# dll when the dll is loaded? Is the dll reloaded each
tiem a method is called from SQL Server or is the DLL loaded once when the
C# dll is added to sql server with CREATE ASSEMBLY?

I wold like to be able to share memory accross calls to methods on the
same C# dll is why. e.g. a Shared ArrayList or a shared Hashtable.

I'm not clear on what you mean with shared memory, are you talking about
memory mapped files, or something else?. I'm also not clear on what you are
trying to achieve here.
To answer the remainder of your question, whenever you call into a managed
function or SP for the first time, the host (SQL Server) loads the CLR which
at his turn creates an Application Domain (AD) and loads your registered
assembly into that AD. The CLR keeps this AD loaded, and with it, the loaded
assemblies, until something really bad happens or until the DB is taken
off-line. The SQL/CLR can reload the AD whenever something bad happens in
your code, but otherwise the assemblies stay loaded until the server stops
or until the DB gets detached. That means that once you have called into a
function/sp your (Jitted) code remains loaded in the SQL Server process
space.

Willy.

Oct 29 '07 #3
DR
http://rafb.net/p/vtxwnj70.html

see that post, it seems to return 1 each tiem as if the app doman keeps
gettin reloaded each time i call the clr sp

"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:uS******** ******@TK2MSFTN GP03.phx.gbl...
"DR" <so************ *******@yahoo.c omwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>CLR Shared Memory, C# DLL load

How to share memory between CLR calls to the same C# dll? Is there some
way to know in the C# dll when the dll is loaded? Is the dll reloaded
each tiem a method is called from SQL Server or is the DLL loaded once
when the C# dll is added to sql server with CREATE ASSEMBLY?

I wold like to be able to share memory accross calls to methods on the
same C# dll is why. e.g. a Shared ArrayList or a shared Hashtable.


I'm not clear on what you mean with shared memory, are you talking about
memory mapped files, or something else?. I'm also not clear on what you
are trying to achieve here.
To answer the remainder of your question, whenever you call into a managed
function or SP for the first time, the host (SQL Server) loads the CLR
which at his turn creates an Application Domain (AD) and loads your
registered assembly into that AD. The CLR keeps this AD loaded, and with
it, the loaded assemblies, until something really bad happens or until the
DB is taken off-line. The SQL/CLR can reload the AD whenever something bad
happens in your code, but otherwise the assemblies stay loaded until the
server stops or until the DB gets detached. That means that once you have
called into a function/sp your (Jitted) code remains loaded in the SQL
Server process space.

Willy.

Oct 29 '07 #4
"DR" <so************ *******@yahoo.c omwrote in message
news:uF******** ******@TK2MSFTN GP06.phx.gbl...
http://rafb.net/p/vtxwnj70.html

see that post, it seems to return 1 each tiem as if the app doman keeps
gettin reloaded each time i call the clr sp
Works for me, returning 0, 1, 2......
Willy.
Oct 30 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2146
by: alanrn | last post by:
I would like to start a dialog on how to implement the equivalent functionality of UNIX shared memory in .NET. I work with a factory automation system. The bulk of the system is written in C/C++. It was ported from UNIX to run under Windows using .NET. If for no other reason than as an educational exercise, I have been wondering what it would take to rewrite the system under C#. The system currently has about a 100K “shared...
1
2587
by: Eric Sasser | last post by:
I'm searching for anyone that has tried working with creating containersin shared memory using the April 2003 article by Grum Ketema in C/C++ UserJournal. I have a project up and running but am noticing that the time required to parse a data file and store data to my containers is increasing with each successive load. Will get into all the details if anyone thinks they may be able to help. Regards,
2
3662
by: Trevor Oakley | last post by:
I am writing thousands of html pages from an MS SQL source using a DataSet and then an XslTransform. I have an interest in making the code run faster as it takes several minutes (sometimes ten minutes) to generate a batch of pages (say two thousand). If anyone has URL resources which performance information germane to XSL Transforms, Streams, and XML I am interested in hearing about them. I have written some notes below of what I am...
96
6251
by: BadPony | last post by:
Anyone using Peoplesoft on a Federated UDB (shared nothing)Environment on Open System Platforms? Preferably AIX, but any war stories would be good. TEA EB-C
2
2449
by: tomdean20 | last post by:
Does anyone have a general idea of the difference in performance when compiling PHP with primarily shared extensions rather than static? A recent Yahoo presentation "PHP at Yahoo" highlighted that they built PHP with the "disable-all" option, which implies that they load all of their extensions dynamically. I'd be curious if anyone has any experience in the performance difference bewteen the two, i.e. 5% performance loss, not just "it's...
1
2745
by: priyachari | last post by:
Can anybody here suggest me whether loading an XML file directly into a shared memory is possible through IPC or should i parse the XML file and load the contents into an structured array and load it into memory...
10
627
by: Oriane | last post by:
Hello, I have to share a object in RAM between several processes. I intend to design a special process to load this objet (an Autocad plan) in memory, and to take care of the read/write operations made by the other processes with WCF based on named pipes. Would you think it is a good idea ? Best regards
0
1734
by: DR | last post by:
CLR Shared Memory, C# DLL load How to share memory between CLR calls to the same C# dll? Is there some way to know in the C# dll when the dll is loaded? Is the dll reloaded each tiem a method is called from SQL Server or is the DLL loaded once when the C# dll is added to sql server with CREATE ASSEMBLY? I wold like to be able to share memory accross calls to methods on the same C# dll is why. e.g. a Shared ArrayList or a shared...
3
4015
by: Man4ish | last post by:
First of all i would like to thank this forum for helping me for all my previous queries and providing help. Now i am successful in developing a search engine. Now moving one step ahead, I need to load the map into memory to make it faster. I am planing to load the index map(map <string, string>) into memory using IPC(shared memory) and using the same with another program. I am successful in storing the string in the memory segment and reading...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.