View Issue Details

IDProjectCategoryView StatusLast Update
0031480FPCDocumentationpublic2017-03-05 10:57
ReporterThaddy de KoningAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAllOSAllOS VersionAll
Product Version3.1.1Product Build35522 
Target Version3.2.0Fixed in Version3.1.1 
Summary0031480: Usage example for heaptrc in the rtl documentation is wrong
DescriptionUsage example for heaptrc in the rtl documentation is wrong.
It explicitly uses heaptrc in the uses clause and this is no longer allowed.

Maybe replace "uses heaptrc" with "{ compile this example with -gh or -glh }"
Steps To ReproduceProgram heapex;

{ Program used to demonstrate the usage of heaptrc unit }

Uses heaptrc; // <=== replace with something like {compile this example with -gh}

Var P1 : ^Longint;
    P2 : Pointer;
    I : longint;

begin
  New(P1);
  // causes previous allocation not to be de-allocated
  New(P1);
  Dispose(P1);
  For I:=1 to 10 do
    begin
    GetMem (P2,128);
    // When I is even, deallocate block. We loose 5 times 128
    // bytes this way.
    If (I mod 2) = 0 Then FreeMem(P2,128);
    end;
  GetMem(P2,128);
  // This will provoke an error and a memory dump
  Freemem (P2,64);
end.
TagsNo tags attached.
Fixed in Revision1403
FPCOldBugId
FPCTarget
Attached Files

Activities

Thaddy de Koning

2017-03-05 07:49

reporter   ~0098644

Last edited: 2017-03-05 09:02

View 2 revisions

http://freepascal.org/docs-html/current/rtl/heaptrc/usage.html
http://freepascal.org/docs-html/current/rtl/heaptrc/index.html

BTW: in trunk the example does not even compile:
Throws "Duplicate Identifier HEAPTRC heaptrc" error

Michael Van Canneyt

2017-03-05 10:57

administrator   ~0098647

Changed the example. Added detection whether the -gh is actually used.

Issue History

Date Modified Username Field Change
2017-03-05 07:47 Thaddy de Koning New Issue
2017-03-05 07:47 Thaddy de Koning Status new => assigned
2017-03-05 07:47 Thaddy de Koning Assigned To => Michael Van Canneyt
2017-03-05 07:49 Thaddy de Koning Note Added: 0098644
2017-03-05 09:02 Thaddy de Koning Note Edited: 0098644 View Revisions
2017-03-05 10:57 Michael Van Canneyt Fixed in Revision => 1403
2017-03-05 10:57 Michael Van Canneyt Note Added: 0098647
2017-03-05 10:57 Michael Van Canneyt Status assigned => resolved
2017-03-05 10:57 Michael Van Canneyt Fixed in Version => 3.1.1
2017-03-05 10:57 Michael Van Canneyt Resolution open => fixed
2017-03-05 10:57 Michael Van Canneyt Target Version => 3.2.0