The space in metadata string pool is not reused for System.String literals. System.String objects are created on demand for strings literals. These System.String objects have own copy of the data.
The metadata string pool is optimized for small size: UTF8 encoding (1 byte per character for ASCII strings), space is reused if possible, etc. System.String is optimized for runtime: Unicode encoding (2 bytes per character), has vtable pointer, etc. An interesting project would be to change System.String implementation to reuse the storage in the metadata if possible, and see what performance characteristics it is going to have. -Jan This posting is provided "AS IS" with no warranties, and confers no rights. -----Original Message----- From: Discussion of the Rotor Shared Source CLI implementation [mailto:[EMAIL PROTECTED] On Behalf Of SUBSCRIBE DOTNET-ROTOR Memomana Sent: Saturday, January 31, 2004 5:36 PM To: [EMAIL PROTECTED] Subject: [DOTNET-ROTOR] Strings In the Metadata Unmanaged API, it is mentioned that strings (including the user-defined strings) are stored in the metadata string pool. However, why are there a lot of System.String object being created during an application execution? I turned on the profiler (ObjectAllocated callback), that come with the CLI distribution, to see this. Are those System.String objects created in the run-time heap? Help? Thank you very much beforehand. Memomana =================================== This list is hosted by DevelopMentor(r) http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com