字符串池和堆空间
为了避免开车后回收空间,sleep持续1小时
jps命令查询Java程序
使用jamp查询堆空间
jmap -dump:format=b,file=aa.bin(aa.bin=任何名称) PID ) PID=Java线程id )。
jhat aa.bin
http://localhost:7000/
我是http://localhost:7000/oql/
OQL Java虚拟机语言查询字符串地址
select s.value.toString () from java.lang.String s
where/kjlhgfc/. test (s.value.tostring ) )
kjlhgfc查询的结果只存在于堆中,并且引用地址存储在字符串常量池中
有两种解释说gfdss查询的结果只存在于堆中,但地址不同,因为存储在字符串常量池中的是字符串
使用' kjlhgf '时,编译周期存储在常量池中,也存储在堆中,但由于append后更改为kjlhgfc,因此只保留一个查询结果。
lsof -i:7000
联系7000端口用户
解释内部方法
/* * returnsacanonicalrepresentationforthestringobject.* p * apoolofstrings,initially empty, ismaintainedprivatelybythe * class { @ code string }.* p * whentheinternmethodisinvoked, ifthepoolalreadycontainsa * stringequaltothis { @ code string } objectasdeterminedby * the { @ link # equals { object } meth oold Returned.Otherwise, this { @ code string } objectisaddedtothe * poolandareferencetothis { @ code string } objectisreturned.* p * itfollowsthatforatforathis *{@codes.intern(==SSDcdq ) is(@codetrue ) ) ifandonlyif ) @codes.equals ) t ) @codetrue ).* p * allliter interned.stringliteralsaredefinedinsection3. 10.5 of the * cite language specification/cite.* @ returnastringthathasthesasthesation