<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<blockquote
cite="mid:6BED0B8B-0AF8-42FA-A387-017F9584BD66@apple.com"
type="cite">
<div>
<blockquote type="cite">
<div text="#000000" bgcolor="#FFFFFF" style="letter-spacing:
normal; orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;">
<blockquote
cite="mid:29C2DC67-546F-4D8B-B74C-EBF84547969B@apple.com"
type="cite">
<div>
<div>
<div>
<blockquote type="cite">
<div text="#000000" bgcolor="#FFFFFF"
style="letter-spacing: normal; orphans: auto;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;">
<blockquote
cite="mid:44CDB5FC-2B2F-4AAE-ADA3-EE06C22B0F3B@apple.com"
type="cite">
<div>
<div>
<div><br>
</div>
<div>
<div>---</div>
<div>+ // Check if an expected
deallocation function matches the real
one.</div>
<div>+ if (RsBase && </div>
<div>+
RsBase->getAllocationFamily() !=
AF_None &&</div>
<div>+
RsBase->getAllocationFamily() !=
getAllocationFamily(C, ParentExpr) ) {</div>
</div>
<div>Is it possible to have AF_None family
here? Shouldn't "
RsBase->getAllocationFamily() !=
AF_None" be inside an assert?</div>
</div>
</div>
</blockquote>
It is possible. In the example below
initWithCharactersNoCopy:length:freeWhenDone
takes ownership of memory allocated by unknown
means, RefState with AF_None is bound to the
call and after, when free() is processed, we
have RsBase->getAllocationFamily() ==
AF_None.<br>
</div>
</blockquote>
<div><br>
</div>
<div>My understanding is that this API assumes that
the memory belongs to the malloc family. So, for
example, we would warn on freeing with a regular
"free" after freeing with
"initWithCharactersNoCopy.. freeWhenDone".</div>
<div><br>
</div>
<div>If the family is unknown, we should not be
tracking the memory at all.</div>
</div>
</div>
</div>
</blockquote>
Great idea, I'll include corresponding changes in the next
patch devoted to unix.MismatchedDeallocator<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
I am sitting on the patch that disables tracking if unknown memory
by checkPostObjCMessage().<br>
The only thing preventing me from committing is the presence of the
following testcase in malloc.mm:<br>
<br>
void test12365078_nocheck_nomalloc(unichar *characters) {<br>
NSString *string = [[NSString alloc]
initWithCharactersNoCopy:characters length:12 freeWhenDone:1];<br>
free(characters); // expected-warning {{Attempt to free non-owned
memory}}<br>
}<br>
<br>
Should this warning be muted?<br>
<pre class="moz-signature" cols="72">--
Anton</pre>
</body>
</html>