Large dataset in memory - .NET Framework and C# -


I have a DLL project that creates the singleton of all the display strings used in my application. I need reference of this DLL for problem in many freely running applications.

I understand that if I refer to the DLL project in all the freely running applications, they will load all the DLLs in memory and the individual singles they can mention, but this There is redundancy I want to save.

Is there a way that I can keep an example of this singleton in memory and can refer it to all independent projects?

I think I can be stupid and it is loading, not at all, but I am searching for about an hour now.)

I'm using it As with Net Framework target language with C #

I will not bother myself with memory consumption. Actually there is a problem. We do some simple math 2 ^ 13 (8192) strings 2 ^ 3 (8) has 2 ^ 16 strings, and if a string is the average size of 2 ^ 8 (256) characters, then the total number of bytes for all applications 2 * 2 ^ 24 (32 MiB), there should be no problem with this, even if the number of strings multiplied by 10.

The amount of work required by other solutions will make them inadequate at the present level. In addition, the common string service will not have any advantage, if the majority of shared strings are used by all applications, it only provides benefits when a small part of the wire is actually shared by all of them.

With Remoting you have to make sure that the Singleton instance has been started in only one place and you have to access it interface. Most likely you want to create a local singleton example which asks the wire a remote example. This solution can also be implemented later if you use the implementation of the old singleton until the other solution is needed.

If you use the Task Manager to track memory usage, then you should have very large strings in the singleton class. / P> Public Static Strings {Private Readonly String Memory UIGest; Static strings () {#} DEBUG int size = 104000000; Var text = "abcdefghijklmnopqrstuvwxyz"; Var sb = new stringbilder (size); For (int i = 0; i

I'm not sure that remoting will be a good option at any time. Anyway, if we believe that this would be a good option, then I would suggest that the current implementation should be utilized in a singleton class which implements the interface. This will make using remote examples very easy.

  Public Interface Etherting {string HelloWorld {get} }} Public Sealed Class Local Traffic Service: Istring {Internal Local Service () {} String Istring. HelloWorld {Returns "Hello World!" }}} Public Static Class Stringware {Private Static Readonly istrends Singleton Instances = New Local Line String Service (); // If the blank steady producer does not make any sense, read it: http: // http://sharpindepth.com/Articles/General/Beforefieldinit.aspx Static String Service () {} Public Stable IStrings Instance {Back Singleton Instance; }}}   

Now, if you want to make this remote, you only need to rename LocalStringService to remotestring service Create it, inherit MarshalByRefObj and change StringService to create a remote instance of it. In addition, Remote String Service should be in another assembly so that other sections are not loaded in memory.

Still, I suspect that this will give you some benefit in this matter.

Comments