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


■ U N D E R S TA N D I N G   O B J E C T   L I F E T I M E 249



Download 21,46 Mb.
Pdf ko'rish
bet509/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   505   506   507   508   509   510   511   512   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

U N D E R S TA N D I N G   O B J E C T   L I F E T I M E



249

8849CH08.qxd  10/22/07  1:27 PM  Page 249




explained in some detail during our discussion of object serialization (Chapter 21). For now, just

understand that object graphs are used to document all reachable objects. As well, be aware that

the garbage collector will never graph the same object twice, thus avoiding the nasty circular refer-

ence count found in COM programming.

Assume the managed heap contains a set of objects named A, B, C, D, E, F, and G. During a

garbage collection, these objects (as well as any internal object references they may contain) are

examined for active roots. Once the graph has been constructed, unreachable objects (which we

will assume are objects C and F) are marked as garbage. Figure 8-3 diagrams a possible object graph

for the scenario just described (you can read the directional arrows using the phrase 

depends on or

requires, for example, “E depends on G and indirectly B,” “A depends on nothing,” and so on).

Figure 8-3.

Object graphs are constructed to determine which objects are reachable by application

roots.

Once an object has been marked for termination (C and F in this case—as they are not

accounted for in the object graph), they are swept from memory. At this point, the remaining space

on the heap is compacted, which in turn will cause the CLR to modify the set of active application

roots (and the underlying pointers) to refer to the correct memory location (this is done automati-

cally and transparently). Last but not least, the next object pointer is readjusted to point to the next

available slot. Figure 8-4 illustrates the resulting readjustment.


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   505   506   507   508   509   510   511   512   ...   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