Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Plan your Crypto & Forex entries before you take the trade
romeshnonis
Updated:
Today at 3:20 AM
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Tuesday at 10:28 AM
🛡️ Kaspersky Antivirus – 1 Year / 1 Device | Rs. 2,300 | Only 9 Left
KSPathirana
Updated:
Sep 7, 2026
Ad icon
Professional CCTV Installation Service
Techguy231
Updated:
Sep 6, 2026
Ad icon
I'll research & write an article - Rs. 2000 onwards
Blogerwiki
Updated:
Sep 3, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
ElaKiri Programmer's Club
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="DooA" data-source="post: 18142277" data-attributes="member: 362085"><p><span style="color: Blue"></span></p><p><span style="color: Blue"><span style="font-size: 12px">GC කියන්නේ මචං උබේ ප්රෝග්රෑම් එක රන් වෙනකොට උබ පාචිච්චි කරපු variables, Instances තව දුරටත් වැඩක් නැත්නම් ඒවා අයින් කරලා දාන එක.</span></span></p><p><span style="color: Blue"><span style="font-size: 12px">System.gc කියලා කතා කරන්න පුළුවන්. එත් වැඩක් නෑ. එක උබට ඕන ඕන විදියට වැඩකරන්නේ නෑ. අපි කතා කරට වැඩ කරන්නේ නෑ. උට ඕන වෙලාවට ඇවිත් වැඩේ කරලා යනවා <img src="/styles/default/xenforo/smilies/default/angry.gif" class="smilie" loading="lazy" alt=":angry:" title="Angry :angry:" data-shortname=":angry:" />.</span></span></p><p><span style="color: Blue"><span style="font-size: 12px"></span></span></p><p><span style="color: Blue"><span style="font-size: 12px">දන්නවනේ java වල primitive ඒවගේ ඇරුනම අනිත් ඒවගේ variable එකේ තියන් ඉන්නේ Instance එකේ reference එකනේ. ඔය reference එක ටියෙනකම් උබට ඒ Instance එකපාචිච්චි කරන්න පුළුවන් . GC කරන්නේ එහෙම පාචිච්චි කරන්න බැරි ඒවා Heap එකෙන් අයින් කරන එක.</span></span></p><p><span style="color: Blue"><span style="font-size: 12px"></span></span></p><p><span style="color: Blue"><span style="font-size: 12px">EG:</span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="font-family: 'Courier New'"></span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="font-family: 'Courier New'">Elakiri e = new Elakiri();</span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"></span></span></p><p><span style="color: Blue"><span style="font-size: 12px">දැන් e කියන var එකේ Elakiri Instance එකක reference එකක් තියෙනවා. ඔය reference එක තියෙනකම් GC ට මුකුත් කරන්න බෑ. </span></span></p><p><span style="color: Blue"><span style="font-size: 12px">අඩුම ගානේ එක reference එකක් හරි තියෙන්න ඕනේ.</span></span></p><p><span style="color: Blue"><span style="font-size: 12px"></span></span></p><p><span style="color: Blue"><span style="font-size: 12px">දැන් උබ </span></span></p><p><span style="color: Blue"><span style="font-size: 12px"></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="font-family: 'Courier New'">e = null;</span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"></span></span></p><p><span style="color: Blue"><span style="font-size: 12px">කරොත් ඒ reference එක නැති වෙනවා. දැන් GC ඇවිත් අර Heap memory එකේ තියෙන instance එක අයින් කරලා දානවා.</span></span></p><p><span style="color: Blue"><span style="font-size: 12px"></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="font-family: 'Courier New'">Elakiri e1 = new Elakiri();</span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="color: SeaGreen">Instance එකක් හැදුවා </span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="font-family: 'Courier New'">Elakiri e2 = e1;</span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="color: SeaGreen">instance එකේ reference එක තව var එකකට assign කරා.</span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="font-family: 'Courier New'">e1 = null;</span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="color: SeaGreen">e1 වැඩ reference එක අයින් කරා. හැබැයි තාම GC ට මුකුත් කරන්න බැ. මොකද තාම e2 var එකට තාම reference එක තියෙනවා.</span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="font-family: 'Courier New'">e2 = null;</span></span></span></p><p><span style="color: Blue"><span style="font-size: 12px"><span style="color: SeaGreen">ඔන්න දැන් GC ඇවිත් elakiri Instance එක memory එකෙන් අයින් කරලා දන්නවා.</span></span></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p><p><span style="color: Blue"></span></p></blockquote><p></p>
[QUOTE="DooA, post: 18142277, member: 362085"] [COLOR=Blue] [SIZE=3]GC කියන්නේ මචං උබේ ප්රෝග්රෑම් එක රන් වෙනකොට උබ පාචිච්චි කරපු variables, Instances තව දුරටත් වැඩක් නැත්නම් ඒවා අයින් කරලා දාන එක. System.gc කියලා කතා කරන්න පුළුවන්. එත් වැඩක් නෑ. එක උබට ඕන ඕන විදියට වැඩකරන්නේ නෑ. අපි කතා කරට වැඩ කරන්නේ නෑ. උට ඕන වෙලාවට ඇවිත් වැඩේ කරලා යනවා :angry:. දන්නවනේ java වල primitive ඒවගේ ඇරුනම අනිත් ඒවගේ variable එකේ තියන් ඉන්නේ Instance එකේ reference එකනේ. ඔය reference එක ටියෙනකම් උබට ඒ Instance එකපාචිච්චි කරන්න පුළුවන් . GC කරන්නේ එහෙම පාචිච්චි කරන්න බැරි ඒවා Heap එකෙන් අයින් කරන එක. EG: [FONT=Courier New] Elakiri e = new Elakiri();[/FONT] දැන් e කියන var එකේ Elakiri Instance එකක reference එකක් තියෙනවා. ඔය reference එක තියෙනකම් GC ට මුකුත් කරන්න බෑ. අඩුම ගානේ එක reference එකක් හරි තියෙන්න ඕනේ. දැන් උබ [FONT=Courier New]e = null;[/FONT] කරොත් ඒ reference එක නැති වෙනවා. දැන් GC ඇවිත් අර Heap memory එකේ තියෙන instance එක අයින් කරලා දානවා. [FONT=Courier New]Elakiri e1 = new Elakiri();[/FONT] [COLOR=SeaGreen]Instance එකක් හැදුවා [/COLOR] [FONT=Courier New]Elakiri e2 = e1;[/FONT] [COLOR=SeaGreen]instance එකේ reference එක තව var එකකට assign කරා.[/COLOR] [FONT=Courier New]e1 = null;[/FONT] [COLOR=SeaGreen]e1 වැඩ reference එක අයින් කරා. හැබැයි තාම GC ට මුකුත් කරන්න බැ. මොකද තාම e2 var එකට තාම reference එක තියෙනවා.[/COLOR] [FONT=Courier New]e2 = null;[/FONT] [COLOR=SeaGreen]ඔන්න දැන් GC ඇවිත් elakiri Instance එක memory එකෙන් අයින් කරලා දන්නවා.[/COLOR][/SIZE] [/COLOR] [/QUOTE]
Insert quotes…
Verification
Nawa warak dahaya keeyada? (Namaya wadi kireema dahaya)
Post reply
Top
Bottom