CS 24000 Study Guide - Midterm Guide: Explicit Memory, Memory Leak, Memory Management

20 views2 pages

For unlimited access to Study Guides, a Grade+ subscription is required.

CS#24000#Lecture#1#Notes-review#2#
!
Out-Of-Bounds#assignment#in#C#
int a[5];
int b[3];
a[2]=789;
b[1]=45;
a[6]=317;
b[1]!"#$$!%&!'(&)")#**&+!,,,,,!
-!-+.!%!#+!/&/')0!
-12!
!
!
-13!
!
!
-14!
567!
!
-18!
!
!
%19!
!
!
%12!
!
!
%13!
9:!
835!
!
C#principle#revisited#
;<!"#$$!+'*!=&*!#+!0'>)!"-0!*'!/-?&!0'>)!@)'=)-/!)>+!A-B*CD!
EF'"&(&)G!<!"#$$!+'*!@)'*&H*!0'>!#A!0'>!/-?&!-!/#B*-?&,,,!
I'>!J-(&!*'!?+'"!"J-*!0'>!-)&!.'+=!
K)'=)-//#+=!-+.!.&%>==#+=!#+!<!#B!/')&!.#AA#H>$*!-+.!*#/&!H'+B>/#+=!*J-+!
@)'=)-//#+=!#+!L-(-!
L-(-!#B!>B&.!#+!-@@$#H-*#'+B!*J-*!.'!+'*!)&M>#)&!*''!/>HJ!<KN!OPQR!%'>+.SC!
TU-/@$&1!"&%!-@@BG!H-$&+.-)!-@@!
<!#B!>B&.!#+!-@@$#H-*#'+B!*J-*!)&M>#)&!-!$'*!'A!<KN!O<KN!%'>+.SC!TU-/@$&1!
V-/&BG!WK8!@$-0&)!
!
Memory#Usage#in#C#and#Java#
L-(-!>B&B!V-)%-=&!<'$$&H*#'+!
o XJ&!LYW!"#$$!H'$$&H*!*J&!'%Z&H*B!*J-*!-)&!>+)&-HJ-%$&!%0!*J&!@)'=)-/!
<!>B&B!&U@$#H#*!/&/')0!/-+-=&/&+*!
o [A*&)!H-$$#+=!@\/-$$'HOB#]&S!*'!-$$'H-*&!/&/')0G!0'>!"#$$!J-(&!*'!H-$$!
A)&&O@S!"J&+!'%Z&H*!@!#B!+'!$'+=&)!#+!>B&!')!#*!"#$$!H'+*#+>&!>B#+=!
/&/')0!#+!*J&!@)'=)-/!
o XJ#B!#B!H-$$&.!-!/&/')0!$&-?!
o PA!*J&!@)'=)-/!J-B!-!$'*!'A!/&/')0!$&-?&.G!*J&!&U&H>*#'+!"#$$!B$'"!
.'"+!.>&!*'!&UH&BB#(&!/&/')0!>B-=&!')!&(&+!H)-BJ!
o PA!0'>)!@)'=)-/!H-$$B!A)&&O@S!-+.!0'>!H'+*#+>&!>B#+=!*J&!'%Z&H*!-)&!
")#*#+=!*'!*J&!'%Z&H*!@'#+*&.!%0!@!*J&+!*J&!/'/')0!-$$'H-*')!.-*-!
B*)>H*>)&B!/-0!=&*!H'))>@*&.!-+.!0'>)!@)'=)-/!"#$$!H)-BJ!
o XJ#B!#B!H-$$&.!-!@)&/-*>)&!A)&&!
W&/')0!-$$'H-*#'+!&))')B!/-?&!@)'=)-//#+=!#+!<!.#AA#H>$*!
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$10 USD/m
Billed $120 USD annually
Homework Help
Class Notes
Textbook Notes
40 Verified Answers
Study Guides
1 Booster Class