74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
puts("Now trying to free them again...");
CATCH_EXCEPTION([obj freeMem: p], OFMemNotPartOfObjException)
CATCH_EXCEPTION([obj freeMem: q], OFMemNotPartOfObjException)
CATCH_EXCEPTION([obj freeMem: r], OFMemNotPartOfObjException)
puts("Got all 3!");
puts("Trying to allocate more memory than possible...");
CATCH_EXCEPTION(p = [obj getMemWithSize: 4294967295U], OFNoMemException)
puts("Allocating 1 byte...");
p = [obj getMemWithSize: 1];
puts("Trying to resize that 1 byte to more than possible...");
CATCH_EXCEPTION(p = [obj resizeMem: p
toSize: 4294967295U],
OFNoMemException)
puts("Trying to resize NULL to 1024 bytes...");
p = [obj resizeMem: NULL
toSize: 1024];
[obj freeMem: p];
|
|
|
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
puts("Now trying to free them again...");
CATCH_EXCEPTION([obj freeMem: p], OFMemNotPartOfObjException)
CATCH_EXCEPTION([obj freeMem: q], OFMemNotPartOfObjException)
CATCH_EXCEPTION([obj freeMem: r], OFMemNotPartOfObjException)
puts("Got all 3!");
puts("Trying to allocate more memory than possible...");
CATCH_EXCEPTION(p = [obj getMemWithSize: SIZE_MAX], OFNoMemException)
puts("Allocating 1 byte...");
p = [obj getMemWithSize: 1];
puts("Trying to resize that 1 byte to more than possible...");
CATCH_EXCEPTION(p = [obj resizeMem: p
toSize: SIZE_MAX],
OFNoMemException)
puts("Trying to resize NULL to 1024 bytes...");
p = [obj resizeMem: NULL
toSize: 1024];
[obj freeMem: p];
|