c# - Is it possible to read all strings in the intern pool? -


it's known in cases when using strings in c#, clr string interning optimization.

so questions are:

  • it possible read strings in intern pool?
  • is there way reference count each interned string?
  • would possible read intern pool separate process space?
  • if none of these possible, what's reasoning not allowing these use cases?

i see being useful when monitoring memory usage in cases. may useful when working sensitive information (although think securestring more preferable in many scenarios).

as far can tell, public methods related string interning string.intern(string) , string.isinterned(string)

i'm asking out of curiosity, not trying solve real problem. realize doing logic based off of string intern pool bad idea.

looking interned strings via code has no use case it's feature not added in language.

however looking strings in memory while debugging program common use case, , there tools that.

you need use tool windbg.exe comes windows sdk. after launching , attaching program command

.loadby sos clr 

and load in extensions debugging .net apps. once have done can command

!dumpheap -strings 

and can see string objects in heap.

as telling if object in list looking @ interned or not, not entirely sure how. if ask new question windbg , how tell if string interned or not may able answer.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -