[SOLVED] CS x = malloc(4)

$25

File Name: CS_x_=_malloc(4).zip
File Size: 150.72 KB

5/5 - (1 vote)

x = malloc(4)
y = malloc(10)
m = malloc(5)
z = malloc(4)
n = malloc(2)
w = malloc(12)
o = malloc(8)
a = malloc(4)
p = malloc(4)
b = malloc(10)
q = malloc(8)
c = malloc(2)
free(m);
free(n);
free(o);
free(p);
free(q);

freelist[0]: 0 = address of first free size 8 chunk
freelist[1]: 60 = address of first free size 12 chunk
freelist[2]: -1 = there are no free size 16 chunks
freelist[3]: -1 = there are no free size 20 chunks
.
.
.
freelist[217]: -1 = there are no free size 876 chunks
freelist[218]: 120 = address of first free size 880 chunk
freelist[219]: -1 = there are no free size 884 chunks
.
.
.
freelist[10000]: -1 = there are no free size 40004 chunks
freelist[10001]: -1 = there are no free chunks bigger than 40004 words

12121212 = the special pattern that marks an in use chunk
98989898 = the special pattern that marks a free chunk.

________________________
heap[0]: 8 = size of chunk
heap[1]: 12121212 = used
heap[2]: x
heap[3]: x
heap[4]: x
heap[5]: x
heap[6]: x
heap[7]: 8 = size of chunk_______________________
heap[8]: 12 = size of chunk
heap[9]: 12121212 = used
heap[10]: y
heap[11]: y
heap[12]: y
heap[13]: y
heap[14]: y
heap[15]: y
heap[16]: y
heap[17]: y
heap[18]: y
heap[19]: 12 = size of chunk _______________________
heap[20]: 8 = size of chunk
heap[21]: 98989898 = free
heap[22]: 36 = address of next size 8 free chunk
heap[23]: 0 = address of previous size 8 free chunk
heap[24]:
heap[25]:
heap[26]:
heap[27]: 8 = size of chunk ________________________
heap[28]: 8 = size of chunk
heap[29]: 12121212 = used
heap[30]: z
heap[31]: z
heap[32]: z
heap[33]: z
heap[34]: z
heap[35]: 8 = size of chunk ________________________
heap[36]: 8 = size of chunk
heap[37]: 98989898 = free
heap[38]: 80 = address of next size 8 free chunk
heap[39]: 20 = address of previous size 8 free chunk
heap[40]:
heap[41]:
heap[42]:
heap[43]: 8 = size of chunk ________________________
heap[44]: 16 = size of chunk
heap[45]: 12121212 = used
heap[46]: w
heap[47]: w
heap[48]: w
heap[49]: w
heap[50]: w
heap[51]: w
heap[52]: w
heap[53]: w
heap[54]: w
heap[55]: w
heap[56]: w
heap[57]: w
heap[58]: w
heap[59]: 16 = size of chunk ________________________
heap[60]: 12 = size of chunk
heap[61]: 98989898 = free
heap[62]: 100 = address of next size 12 free chunk
heap[63]: 0 = address of previous size 12 free chunk
heap[64]:
heap[65]:
heap[66]:
heap[67]:
heap[68]:
heap[69]:
heap[70]:
heap[71]: 12 = size of chunk _______________________
heap[72]: 8 = size of chunk
heap[73]: 12121212 = used
heap[74]: a
heap[75]: a
heap[76]: a
heap[77]: a
heap[78]: a
heap[79]: 8 = size of chunk _______________________
heap[80]: 8 = size of chunk
heap[81]: 98989898 = free
heap[82]: 0 = no next size 8 free chunk
heap[83]: 36 = address of previous size 8 free chunk
heap[84]:
heap[85]:
heap[86]:
heap[87]: 8 = size of chunk _______________________
heap[88]: 12 = size of chunk
heap[89]: 12121212 = used
heap[90]: b
heap[91]: b
heap[92]: b
heap[93]: b
heap[94]: b
heap[95]: b
heap[96]: b
heap[97]: b
heap[98]: b
heap[99]: 12 = size of chunk _____________________
heap[100]: 12 = size of chunk
heap[101]: 98989898 = free
heap[102]: 0 = no next size 12 free chunk
heap[103]: 60 = address of previous size 12 chunk
heap[104]:
heap[105]:
heap[106]:
heap[107]:
heap[108]:
heap[109]:
heap[110]:
heap[111]: 12 = size of chunk ____________________
heap[112]: 8 = size of chunk
heap[113]: 12121212 = used
heap[114]: c
heap[115]: c
heap[116]: c
heap[117]: c
heap[118]: c
heap[119]: 8 = size of chunk _____________________
heap[120]: 880 = size of chunk
heap[121]: 98989898 = free
heap[122]: 0 = no next size 880 free chunk
heap[123]: 0 = no previous size 880 free chunk
heap[124]:
heap[125]:
heap[126]:
heap[127]:
heap[128]:
heap[129]:
heap[130]:
heap[131]:
heap[132]:
heap[133]:
heap[134]:
heap[135]:
heap[136]:
heap[137]:
heap[138]:
heap[139]:
heap[140]:
heap[141]:
heap[142]:
heap[143]:
heap[144]:
heap[145]:
heap[146]:
heap[147]:
heap[148]:
heap[149]:
heap[150]:
heap[151]:
heap[152]:
heap[153]:
heap[154]:
heap[155]:
heap[156]:
heap[157]:
heap[158]:
heap[159]:
heap[160]:
heap[161]:
heap[162]:
heap[163]:
heap[164]:
heap[165]:
heap[166]:
heap[167]:
heap[168]:
heap[169]:
heap[170]:
heap[171]:
heap[172]:
heap[173]:
heap[174]:
heap[175]:
heap[176]:
heap[177]:
heap[178]:
heap[179]:
heap[180]:
heap[181]:
heap[182]:
heap[183]:
heap[184]:
heap[185]:
heap[186]:
heap[187]:
heap[188]:
heap[189]:
heap[190]:
heap[191]:
heap[192]:
heap[193]:
heap[194]:
heap[195]:
heap[196]:
heap[197]:
heap[198]:
heap[199]:
heap[200]:
heap[201]:
heap[202]:
heap[203]:
heap[204]:
heap[205]:
heap[206]:
heap[207]:
heap[208]:
heap[209]:
heap[210]:
heap[211]:
heap[212]:
heap[213]:
heap[214]:
heap[215]:
heap[216]:
heap[217]:
heap[218]:
heap[219]:
heap[220]:
heap[221]:
heap[222]:
heap[223]:
heap[224]:
heap[225]:
heap[226]:
heap[227]:
heap[228]:
heap[229]:
heap[230]:
heap[231]:
heap[232]:
heap[233]:
heap[234]:
heap[235]:
heap[236]:
heap[237]:
heap[238]:
heap[239]:
heap[240]:
heap[241]:
heap[242]:
heap[243]:
heap[244]:
heap[245]:
heap[246]:
heap[247]:
heap[248]:
heap[249]:
heap[250]:
heap[251]:
heap[252]:
heap[253]:
heap[254]:
heap[255]:
heap[256]:
heap[257]:
heap[258]:
heap[259]:
heap[260]:
heap[261]:
heap[262]:
heap[263]:
heap[264]:
heap[265]:
heap[266]:
heap[267]:
heap[268]:
heap[269]:
heap[270]:
heap[271]:
heap[272]:
heap[273]:
heap[274]:
heap[275]:
heap[276]:
heap[277]:
heap[278]:
heap[279]:
heap[280]:
heap[281]:
heap[282]:
heap[283]:
heap[284]:
heap[285]:
heap[286]:
heap[287]:
heap[288]:
heap[289]:
heap[290]:
heap[291]:
heap[292]:
heap[293]:
heap[294]:
heap[295]:
heap[296]:
heap[297]:
heap[298]:
heap[299]:
heap[300]:
heap[301]:
heap[302]:
heap[303]:
heap[304]:
heap[305]:
heap[306]:
heap[307]:
heap[308]:
heap[309]:
heap[310]:
heap[311]:
heap[312]:
heap[313]:
heap[314]:
heap[315]:
heap[316]:
heap[317]:
heap[318]:
heap[319]:
heap[320]:
heap[321]:
heap[322]:
heap[323]:
heap[324]:
heap[325]:
heap[326]:
heap[327]:
heap[328]:
heap[329]:
heap[330]:
heap[331]:
heap[332]:
heap[333]:
heap[334]:
heap[335]:
heap[336]:
heap[337]:
heap[338]:
heap[339]:
heap[340]:
heap[341]:
heap[342]:
heap[343]:
heap[344]:
heap[345]:
heap[346]:
heap[347]:
heap[348]:
heap[349]:
heap[350]:
heap[351]:
heap[352]:
heap[353]:
heap[354]:
heap[355]:
heap[356]:
heap[357]:
heap[358]:
heap[359]:
heap[360]:
heap[361]:
heap[362]:
heap[363]:
heap[364]:
heap[365]:
heap[366]:
heap[367]:
heap[368]:
heap[369]:
heap[370]:
heap[371]:
heap[372]:
heap[373]:
heap[374]:
heap[375]:
heap[376]:
heap[377]:
heap[378]:
heap[379]:
heap[380]:
heap[381]:
heap[382]:
heap[383]:
heap[384]:
heap[385]:
heap[386]:
heap[387]:
heap[388]:
heap[389]:
heap[390]:
heap[391]:
heap[392]:
heap[393]:
heap[394]:
heap[395]:
heap[396]:
heap[397]:
heap[398]:
heap[399]:
heap[400]:
heap[401]:
heap[402]:
heap[403]:
heap[404]:
heap[405]:
heap[406]:
heap[407]:
heap[408]:
heap[409]:
heap[410]:
heap[411]:
heap[412]:
heap[413]:
heap[414]:
heap[415]:
heap[416]:
heap[417]:
heap[418]:
heap[419]:
heap[420]:
heap[421]:
heap[422]:
heap[423]:
heap[424]:
heap[425]:
heap[426]:
heap[427]:
heap[428]:
heap[429]:
heap[430]:
heap[431]:
heap[432]:
heap[433]:
heap[434]:
heap[435]:
heap[436]:
heap[437]:
heap[438]:
heap[439]:
heap[440]:
heap[441]:
heap[442]:
heap[443]:
heap[444]:
heap[445]:
heap[446]:
heap[447]:
heap[448]:
heap[449]:
heap[450]:
heap[451]:
heap[452]:
heap[453]:
heap[454]:
heap[455]:
heap[456]:
heap[457]:
heap[458]:
heap[459]:
heap[460]:
heap[461]:
heap[462]:
heap[463]:
heap[464]:
heap[465]:
heap[466]:
heap[467]:
heap[468]:
heap[469]:
heap[470]:
heap[471]:
heap[472]:
heap[473]:
heap[474]:
heap[475]:
heap[476]:
heap[477]:
heap[478]:
heap[479]:
heap[480]:
heap[481]:
heap[482]:
heap[483]:
heap[484]:
heap[485]:
heap[486]:
heap[487]:
heap[488]:
heap[489]:
heap[490]:
heap[491]:
heap[492]:
heap[493]:
heap[494]:
heap[495]:
heap[496]:
heap[497]:
heap[498]:
heap[499]:
heap[500]:
heap[501]:
heap[502]:
heap[503]:
heap[504]:
heap[505]:
heap[506]:
heap[507]:
heap[508]:
heap[509]:
heap[510]:
heap[511]:
heap[512]:
heap[513]:
heap[514]:
heap[515]:
heap[516]:
heap[517]:
heap[518]:
heap[519]:
heap[520]:
heap[521]:
heap[522]:
heap[523]:
heap[524]:
heap[525]:
heap[526]:
heap[527]:
heap[528]:
heap[529]:
heap[530]:
heap[531]:
heap[532]:
heap[533]:
heap[534]:
heap[535]:
heap[536]:
heap[537]:
heap[538]:
heap[539]:
heap[540]:
heap[541]:
heap[542]:
heap[543]:
heap[544]:
heap[545]:
heap[546]:
heap[547]:
heap[548]:
heap[549]:
heap[550]:
heap[551]:
heap[552]:
heap[553]:
heap[554]:
heap[555]:
heap[556]:
heap[557]:
heap[558]:
heap[559]:
heap[560]:
heap[561]:
heap[562]:
heap[563]:
heap[564]:
heap[565]:
heap[566]:
heap[567]:
heap[568]:
heap[569]:
heap[570]:
heap[571]:
heap[572]:
heap[573]:
heap[574]:
heap[575]:
heap[576]:
heap[577]:
heap[578]:
heap[579]:
heap[580]:
heap[581]:
heap[582]:
heap[583]:
heap[584]:
heap[585]:
heap[586]:
heap[587]:
heap[588]:
heap[589]:
heap[590]:
heap[591]:
heap[592]:
heap[593]:
heap[594]:
heap[595]:
heap[596]:
heap[597]:
heap[598]:
heap[599]:
heap[600]:
heap[601]:
heap[602]:
heap[603]:
heap[604]:
heap[605]:
heap[606]:
heap[607]:
heap[608]:
heap[609]:
heap[610]:
heap[611]:
heap[612]:
heap[613]:
heap[614]:
heap[615]:
heap[616]:
heap[617]:
heap[618]:
heap[619]:
heap[620]:
heap[621]:
heap[622]:
heap[623]:
heap[624]:
heap[625]:
heap[626]:
heap[627]:
heap[628]:
heap[629]:
heap[630]:
heap[631]:
heap[632]:
heap[633]:
heap[634]:
heap[635]:
heap[636]:
heap[637]:
heap[638]:
heap[639]:
heap[640]:
heap[641]:
heap[642]:
heap[643]:
heap[644]:
heap[645]:
heap[646]:
heap[647]:
heap[648]:
heap[649]:
heap[650]:
heap[651]:
heap[652]:
heap[653]:
heap[654]:
heap[655]:
heap[656]:
heap[657]:
heap[658]:
heap[659]:
heap[660]:
heap[661]:
heap[662]:
heap[663]:
heap[664]:
heap[665]:
heap[666]:
heap[667]:
heap[668]:
heap[669]:
heap[670]:
heap[671]:
heap[672]:
heap[673]:
heap[674]:
heap[675]:
heap[676]:
heap[677]:
heap[678]:
heap[679]:
heap[680]:
heap[681]:
heap[682]:
heap[683]:
heap[684]:
heap[685]:
heap[686]:
heap[687]:
heap[688]:
heap[689]:
heap[690]:
heap[691]:
heap[692]:
heap[693]:
heap[694]:
heap[695]:
heap[696]:
heap[697]:
heap[698]:
heap[699]:
heap[700]:
heap[701]:
heap[702]:
heap[703]:
heap[704]:
heap[705]:
heap[706]:
heap[707]:
heap[708]:
heap[709]:
heap[710]:
heap[711]:
heap[712]:
heap[713]:
heap[714]:
heap[715]:
heap[716]:
heap[717]:
heap[718]:
heap[719]:
heap[720]:
heap[721]:
heap[722]:
heap[723]:
heap[724]:
heap[725]:
heap[726]:
heap[727]:
heap[728]:
heap[729]:
heap[730]:
heap[731]:
heap[732]:
heap[733]:
heap[734]:
heap[735]:
heap[736]:
heap[737]:
heap[738]:
heap[739]:
heap[740]:
heap[741]:
heap[742]:
heap[743]:
heap[744]:
heap[745]:
heap[746]:
heap[747]:
heap[748]:
heap[749]:
heap[750]:
heap[751]:
heap[752]:
heap[753]:
heap[754]:
heap[755]:
heap[756]:
heap[757]:
heap[758]:
heap[759]:
heap[760]:
heap[761]:
heap[762]:
heap[763]:
heap[764]:
heap[765]:
heap[766]:
heap[767]:
heap[768]:
heap[769]:
heap[770]:
heap[771]:
heap[772]:
heap[773]:
heap[774]:
heap[775]:
heap[776]:
heap[777]:
heap[778]:
heap[779]:
heap[780]:
heap[781]:
heap[782]:
heap[783]:
heap[784]:
heap[785]:
heap[786]:
heap[787]:
heap[788]:
heap[789]:
heap[790]:
heap[791]:
heap[792]:
heap[793]:
heap[794]:
heap[795]:
heap[796]:
heap[797]:
heap[798]:
heap[799]:
heap[800]:
heap[801]:
heap[802]:
heap[803]:
heap[804]:
heap[805]:
heap[806]:
heap[807]:
heap[808]:
heap[809]:
heap[810]:
heap[811]:
heap[812]:
heap[813]:
heap[814]:
heap[815]:
heap[816]:
heap[817]:
heap[818]:
heap[819]:
heap[820]:
heap[821]:
heap[822]:
heap[823]:
heap[824]:
heap[825]:
heap[826]:
heap[827]:
heap[828]:
heap[829]:
heap[830]:
heap[831]:
heap[832]:
heap[833]:
heap[834]:
heap[835]:
heap[836]:
heap[837]:
heap[838]:
heap[839]:
heap[840]:
heap[841]:
heap[842]:
heap[843]:
heap[844]:
heap[845]:
heap[846]:
heap[847]:
heap[848]:
heap[849]:
heap[850]:
heap[851]:
heap[852]:
heap[853]:
heap[854]:
heap[855]:
heap[856]:
heap[857]:
heap[858]:
heap[859]:
heap[860]:
heap[861]:
heap[862]:
heap[863]:
heap[864]:
heap[865]:
heap[866]:
heap[867]:
heap[868]:
heap[869]:
heap[870]:
heap[871]:
heap[872]:
heap[873]:
heap[874]:
heap[875]:
heap[876]:
heap[877]:
heap[878]:
heap[879]:
heap[880]:
heap[881]:
heap[882]:
heap[883]:
heap[884]:
heap[885]:
heap[886]:
heap[887]:
heap[888]:
heap[889]:
heap[890]:
heap[891]:
heap[892]:
heap[893]:
heap[894]:
heap[895]:
heap[896]:
heap[897]:
heap[898]:
heap[899]:
heap[900]:
heap[901]:
heap[902]:
heap[903]:
heap[904]:
heap[905]:
heap[906]:
heap[907]:
heap[908]:
heap[909]:
heap[910]:
heap[911]:
heap[912]:
heap[913]:
heap[914]:
heap[915]:
heap[916]:
heap[917]:
heap[918]:
heap[919]:
heap[920]:
heap[921]:
heap[922]:
heap[923]:
heap[924]:
heap[925]:
heap[926]:
heap[927]:
heap[928]:
heap[929]:
heap[930]:
heap[931]:
heap[932]:
heap[933]:
heap[934]:
heap[935]:
heap[936]:
heap[937]:
heap[938]:
heap[939]:
heap[940]:
heap[941]:
heap[942]:
heap[943]:
heap[944]:
heap[945]:
heap[946]:
heap[947]:
heap[948]:
heap[949]:
heap[950]:
heap[951]:
heap[952]:
heap[953]:
heap[954]:
heap[955]:
heap[956]:
heap[957]:
heap[958]:
heap[959]:
heap[960]:
heap[961]:
heap[962]:
heap[963]:
heap[964]:
heap[965]:
heap[966]:
heap[967]:
heap[968]:
heap[969]:
heap[970]:
heap[971]:
heap[972]:
heap[973]:
heap[974]:
heap[975]:
heap[976]:
heap[977]:
heap[978]:
heap[979]:
heap[980]:
heap[981]:
heap[982]:
heap[983]:
heap[984]:
heap[985]:
heap[986]:
heap[987]:
heap[988]:
heap[989]:
heap[990]:
heap[991]:
heap[992]:
heap[993]:
heap[994]:
heap[995]:
heap[996]:
heap[997]:
heap[998]:
heap[999]: 880 = size of chunk _______________

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS x = malloc(4)
$25