WPCubed Product Support

out of memory on merging

hi julian,

We are have some trouble when doing merge and submerge of many documents.
The problem happen when using fastmm. See Below the Fastmm´s log please.

FastMM has detected an error during a GetMem operation. FastMM detected that a block has been modified after being freed. 

The previous block size was: 116

Stack trace of when this block was previously allocated (return addresses):
402EA8 [system.pas][System][@GetMem][2439]
404253 [system.pas][System][TObject.NewInstance][8360]
40462E [system.pas][System][@ClassCreate][9019]
404288 [system.pas][System][TObject.Create][8375]
43B2A2 [Graphics.pas][Graphics][TGraphic.Create][3330]
43F038 [Graphics.pas][Graphics][TBitmap.Create][5286]
59FE86 [WPRTEPaint][TWPRTFEnginePaint.Create]
5F5208 [WPCTRMemo.pas][WPCTRMemo][TWPCustomRtfEdit.Create][4396]
40425C [system.pas][System][TObject.NewInstance][8360]

The block was previously used for an object of class: TBitmapImage

Stack trace of when the block was previously freed (return addresses):
402ED3 [system.pas][System][@FreeMem][2466]
404271 [system.pas][System][TObject.FreeInstance][8366]
404679 [system.pas][System][@ClassDestroy][9060]
43E52C [Graphics.pas][Graphics][TBitmapImage.Destroy][4791]
4042B7 [system.pas][System][TObject.Free][8385]
43E4AB [Graphics.pas][Graphics][TSharedImage.Release][4773]
43F0A0 [Graphics.pas][Graphics][TBitmap.Destroy][5294]
4042B7 [system.pas][System][TObject.Free][8385]
59FF25 [WPRTEPaint][TWPRTFEnginePaint.Destroy]

The current stack trace leading to this error (return addresses): 
402EA8 [system.pas][System][@GetMem][2439]
404253 [system.pas][System][TObject.NewInstance][8360]
40462E [system.pas][System][@ClassCreate][9019]
5934D1 [WPRTEDefs][TWPTextObj.Create]
402EA8 [system.pas][System][@GetMem][2439]
59B997 [WPRTEDefs][TWPCustomTextReader.PrintTextObj]
5E214B [WPIOReadRTF.pas][WPIOReadRTF][TWPRTFReader.CloseDestination][2457]
5DF1A6 [WPIOReadRTF.pas][WPIOReadRTF][TWPRTFReader.PopStack][1153]
5E3D29 [WPIOReadRTF.pas][WPIOReadRTF][TWPRTFReader.Parse][3189]

Current memory dump of 256 bytes starting at pointer address 2B79E70:
D8 78 6E 00 80 80 80 80 80 80 80 80 80 80 00 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 EF 61 48 FD 00 00 00 00 10 81 B7 02
00 00 00 00 00 00 00 00 FF FF FF FF A8 2E 40 00 53 42 40 00 2E 46 40 00 D1 34 59 00 45 B1 40 00
97 B9 59 00 47 AE 5E 00 C8 3C 5E 00 20 C6 42 00 D3 2E 40 00 71 42 40 00 79 46 40 00 CD 93 42 00
B7 42 40 00 46 FF 59 00 B7 42 40 00 AC 55 5F 00 9E 68 61 00 6C 00 00 00 58 5C 54 00 EF 9E B7 02
44 5A 54 00 01 00 00 00 00 00 00 00 09 01 00 00 00 00 00 00 10 5F B1 02 FF FF FF FF 08 80 86 03
Ø  x  n  .  €  €  €  €  €  €  €  €  €  €  .  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €
€  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €
€  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €
€  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  ï  a  H  ý  .  .  .  .  .    ·  .
.  .  .  .  .  .  .  .  ÿ  ÿ  ÿ  ÿ  ¨  .  @  .  S  B  @  .  .  F  @  .  Ñ  4  Y  .  E  ±  @  .
—  ¹  Y  .  G  ®  ^  .  È  <  ^  .     Æ  B  .  Ó  .  @  .  q  B  @  .  y  F  @  .  Í  “  B  .
·  B  @  .  F  ÿ  Y  .  ·  B  @  .  ¬  U  _  .  ž  h  a  .  l  .  .  .  X  \  T  .  ï  ž  ·  .
D  Z  T  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  _  ±  .  ÿ  ÿ  ÿ  ÿ  .  €  †  .
#1 ♥ 0
4.4k Views 2 users read 3 min
support

Hi,

You should keep the second TWPRichText You use for merging. Even better, use a TWPCustomRTFEdit with CreateDynamic.

The log does not point to any error.

Julian

#2 ♥ 0

Ok, julian we change the code to create just 2 objects wptools objects

This is my process. The user mount a document with header, footer and at body it can put a field. this fields is a composiition of many other litle documents. ie.

FRichText := TWPRichText.Create(nil);
  while...
  begin
      ...
      FRichText.BodyText.Clear;
      FRichText.CPPosition := $FFFFFF;
      FRichText.SelectionAsString := MergeItems;
      ...
      PrintDocumento(FRichText);
      NextDocument;
  end;
  FreeAndNil(FRichText);
  ...

  ---------------------

  function MergeItems: string;
  var
    vEditorTmp: TWPRichText;
  begin
    vEditorTmp := TWPRichText.CreateDynamic;
    while.....
    begin
      ...
      // To Item use the same configuration Document
      vEditorTmp.AsString := FRichText.AsString;
      vEditorTmp.ClearBody;
      vEditorTmp.CPPosition := $FFFFFFF;
      ...
      vEditorTmp.SelectionAsString := MergeItem;
      vEditorTmp.CPPosition := $FFFFFFF;
      vEditorTmp.Refresh;
      ...
      NextItem;
    end;
    ...
    Result := vEditorTmp.AsString;
    FreeAndNil(vEditorTmp);
  end;

MergeItem get a model and do merge.
see that we are cleaning the rtfedits before each iteration, yet the memory is being used increasingly.

#3 ♥ 0
This category is archived. No new posts are possible.