type TGBrush = class private const MaxBrushes = 1000; var imginf :imageInfo; brushList :tstringlist; setedBrush :TImage; BeginCoords :Tpoint; NowPainting :boolean; public procedure setBrush(BNumber:integer;color:tbgra); procedure paintBrush(x, y:integer); procedure BrushTo(x,y:integer); procedure EndPaint; constructor Create(Image: ImageInfo); end; //////////////////////////////////////////////////////////// var b:tgbrush; begin b:=tgbrush.Create(can.imgInf); //Stack overflow end; 

What am I doing wrong??

  constructor TGBrush.create(Image: ImageInfo); var sl:TSearchRec; i:integer; begin // здесь всё закоментированно end; //////////////////////////////////////////////////////////// type Tbgra = record b,g,r,a:byte; end; type bgraArray = array [1..imgmaxwh] of Tbgra; Pbgra1dArray=^bgraArray; type Bgra2dArray = array [1..imgmaxworh] of array [1..imgmaxworh] of ^tbgra; type ImageInfo = record width, height :integer; bufDC :hdc; srcHDC :hwnd; pixels1d :Pbgra1darray; pixels2d :Bgra2darray; end; 
  • provide the Create constructor code (Image: ImageInfo) - UserTest
  • I tried to remove the var section in the constructor - but the error remains - ololo
  • if imgInf for a can object is a property (property) and not a member of the class, then a stack overflow in its code cannot occur? - UserTest 3:08 pm
  • I replaced the imginf with a simple variable of the same type, anyway, the error remains. - ololo
  • one
    give the code of the class ImageInfo, it is also possible to class the variable can, it seems the error is somewhere in them - UserTest

1 answer 1

I think I get it. I pass as a parameter in the ImageInfo record an array of 3000x3000 (imgMaxWH = 9000000) elements - Bgra2dArray. A stack for such an array is not enough. You only need to pass a pointer to it.

  • It seems that so, because record class variables to mine are always stored on the stack, and the stack can quickly overflow if you create a lot of such records - UserTest