Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-06

GetMem crazy problem

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Eduardo Morras

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 (sDiccnil) AND (nDiccnil) AND (ppmvnil) 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 (sDiccnil)... a runtime error 201 appears

what's the next step??

Any clues??

TIA

Las personas se dividen en tres grupos, los que saben contar y los que no. There are three groups of people, who can count, and who cannot.

Reply by email

Alan Mead
to Eduardo Morras

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 wrote 49 lines
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 (sDiccnil) AND (nDiccnil) AND (ppmvnil) 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 (sDiccnil)... a runtime error 201 appears what's the next step?? Any clues?? TIA Las personas se dividen en tres grupos, los que saben contar y los que no. There are three groups of people, who can count, and who cannot. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

=====
A Congressman was once asked about his attitude toward whiskey. "If you mean the demon drink that poisons the mind, pollutes the body, desecrates family life, and inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the taxable potion that puts needed funds into public coffers to comfort little crippled children, then I'm for it."

"This is my position, and I will not compromise."

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com

Reply by email

Alan Mead
to Alan Mead

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

--- Alan Mead wrote 7 lines
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

Show quoted text 89 lines
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 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 (sDiccnil) AND (nDiccnil) AND (ppmvnil) 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 (sDiccnil)... a runtime error 201 appears > > what's the next step?? > > Any clues?? > > TIA > > Las personas se dividen en tres grupos, los que saben contar y los > que no. > There are three groups of people, who can count, and who > cannot. > > > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal ===== A Congressman was once asked about his attitude toward whiskey. "If you mean the demon drink that poisons the mind, pollutes the body, desecrates family life, and inflames sinners, then I'm against it. " "But if you mean the elixir of Christmas cheer, the shield against winter chill, the taxable potion that puts needed funds into public coffers to comfort little crippled children, then I'm for it." "This is my position, and I will not compromise." __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

=====
A Congressman was once asked about his attitude toward whiskey. "If you mean the demon drink that poisons the mind, pollutes the body, desecrates family life, and inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the taxable potion that puts needed funds into public coffers to comfort little crippled children, then I'm for it."

"This is my position, and I will not compromise."

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com

Reply by email

Eduardo Morras
to Alan Mead
you wrote 5 lines
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

Show quoted text 62 lines
--- Alan Mead 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 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 (sDiccnil) AND (nDiccnil) AND (ppmvnil) 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 (sDiccnil)... 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

Reply by email

Alan Mead
to Eduardo Morras
--- Eduardo Morras wrote 25 lines
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

Is 1.0.8 available? I just checked www.freepascal.org and it seems like 1.06 is the current release. You might try that version and see if the problem goes away.

-Alan

=====
A Congressman was once asked about his attitude toward whiskey. "If you mean the demon drink that poisons the mind, pollutes the body, desecrates family life, and inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the taxable potion that puts needed funds into public coffers to comfort little crippled children, then I'm for it."

"This is my position, and I will not compromise."

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com

Reply by email

Eduardo Morras
to Alan Mead
you wrote 5 lines
Is 1.0.8 available? I just checked www.freepascal.org and it seems like 1.06 is the current release. You might try that version and see if the problem goes away. -Alan

1.07 and 1.08 are updates to 1.06. You must download them and install by hand. In a few weeks (accordlying to a previous post) 1.08 will be out.

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

Reply by email

Jonas Maebe
to Eduardo Morras: That's what surprise me, so rechecked and yes, the rte is 201. I get the error when i…
Eduardo Morras wrote 11 lines
> 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. 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.

This sounds like some memory corruption is going on in your program. There are unfortunately no really easy ways to find out where this happens.

Jonas

Reply by email