[fpc-pascal]GetMem crazy problem

Eduardo Morras nec556 at ave128.retena.es
Tue Jun 10 23:20:36 CEST 2003


At 12:46 10/06/2003 -0700, you wrote:
>I just looked at this again.  If you are really getting RTE 201 then
>it (probably) has nothing to do with the GetMem's.  It means you are
>over-indexing your arrays or seomthing similar.  Good luck.
>
>-Alan


That's what surprise me, so rechecked and yes, the rte is 201. I get the 
error when i don't check them for nil. If i chek the nil, the program never 
enters in the code. I use them to navigate throught lists structures 
defined as global. As said, if i define them as global too i get.... the 
GetMem works!!!...   and the rte 201 apears again. Perhaps i use them 
badly, but the main problem for me was the not allocation of memory for them.


Also i use fpc 1.08

Thanks
>--- Alan Mead <cubrewer at yahoo.com> wrote:
> > Eduardo,
> >
> > I did not follow your example, but are you aware of the "growing
> > heap" behavior of FreePascal and the ReturnNilGrowHeapFails
> > variable?
> >
> >
>http://www.freepascal.org/docs-html/prog/progsu113.html#x163-1680008.4
> >
> > Also, I think this ReturnNilGrowHeapFails behavior is broken in
> > 1.0.6
> > and fixed in 1.0.7 (which, I think, is not available yet).
> >
> > But I don't know why you get RTE 201?  (You should be getting 203
> > or
> > 216 or something)
> >
> > -Alan
> >
> >
> > --- Eduardo Morras <nec556 at ave128.retena.es> wrote:
> > > Hello:
> > >          I've got a weird problem with getmem. I have check
> > > everything (i
> > > think) but i can't get it work. Heaptrc says it's all ok, but
> > when
> > > i
> > > de-comment the next three lines ( the freemem also ),  all fails
> > >
> > >       GetMem(sDicc,sizeof(rtBusqBidimen));
> > >       GetMem(ppmv,sizeof(rtMotionVector));
> > >       GetMem(nDicc,sizeof(rtBusqBidimen));
> > >
> > >       if (sDicc<>nil) AND (nDicc<>nil) AND (ppmv<>nil) then
> > >          writeln('MAS MEMORIA PARA VECTORMOTION') // Chequeo de
> > > memoria
> > > INICIAL
> > >         {More Memory for VECTORMOTION //NITIAL memory check}
> > >       else begin
> > > ......
> > >
> > > The sizes are 14,8,14, MemAvail says near 48Mb and MaxAvail 47'5.
> > I
> > >
> > > tried  to put them in the program vars (they are in a function),
> > > change the
> > > sizeof (which print on screen 14,8,14) to it's values re-type for
> > a
> > >
> > > misspelling error. Their declartions at var are
> > >
> > > nDicc,sDicc       : prtBusqBidimen;  // p= point r= record t=
> > type
> > > BusqDimen
> > > ppmv                 : prtMotionVector;  // id. MotionVector
> > >
> > > When skip the if (sDicc<>nil)... a runtime error 201 appears
> > >
> > > what's the next step??
> > >
> > > Any clues??

-----------------------------------------------------------------------------------------------------------------------------
La diferencia entre la teoria y la practica es que en teoria no hay, pero 
en la practica si





More information about the fpc-pascal mailing list