Menu

#2 Unallocated header in DRedBlackTree class.

open
nobody
None
5
2004-06-03
2004-06-03
Anonymous
No

Method Destroy of DRedBlackTree does not Free the
FHeader node.
Using pooled memory, all the memory is freed during
finalization, but the node memory is not actually
released to the pool that cannot reuse it.
Disabling pools and analyzing with a memory leak tool
the problem comes out.
This is my patch in DeCal.pas:

---before---
destructor DRedBlackTree.Destroy;
begin
erase(false);
inherited;
end;

---after
destructor DRedBlackTree.Destroy;
begin
erase(false);
assert(FHeader<>nil);
FHeader.Free;
inherited;
end;

One more thing: the ni_node is allocated but never
freed. This is another patch in DeCal.pas:
---before---
finalization
Cleanup;
end.

---after---
finalization
Cleanup;
if nil_node <> nil then
nil_node.Free;
end.

Tracker: perr@com.dist.unige.it

Discussion

  • Nobody/Anonymous

    Logged In: NO

    The second of part of this patch, regarding the
    finalization, raises an Access Violation, then you should
    not apply it.

     
  • Nobody/Anonymous

    Logged In: NO

    The second of part of this patch, regarding the
    finalization, raises an Access Violation, then you should
    not apply it.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.