This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy


// If myCar is the only reference to the Car object



Download 21,46 Mb.
Pdf ko'rish
bet501/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   497   498   499   500   501   502   503   504   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

// If myCar is the only reference to the Car object,

// it *may* be destroyed when this method returns.

Car myCar = new Car();

}

Notice that the Car reference (myCar) has been created directly within the MakeACar() method



and has not been passed outside of the defining scope (via a return value or ref/out parameters).

Thus, once this method call completes, the myCar reference is no longer reachable, and the associ-

ated Car object is now a candidate for garbage collection. Understand, however, that you cannot

guarantee that this object will be reclaimed from memory immediately after MakeACar() has com-

pleted. All you can assume at this point is that when the CLR performs the next garbage collection,

the myCar object could be safely destroyed.

As you will most certainly discover, programming in a garbage-collected environment will

greatly simplify your application development. In stark contrast, C++ programmers are painfully

aware that if they fail to manually delete heap-allocated objects, memory leaks are never far behind.

In fact, tracking down memory leaks is one of the most time-consuming (and tedious) aspects of

programming with unmanaged languages. By allowing the garbage collector to be in charge of

destroying objects, the burden of memory management has been taken from your shoulders and

placed onto those of the CLR.


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   497   498   499   500   501   502   503   504   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish