Recent

Author Topic: set memory size  (Read 9245 times)

mikita

  • Guest
set memory size
« on: April 11, 2006, 11:59:05 pm »
I have many variebles, about 100.000 in array of single. How to set max. memory size in the Lazarus??

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
RE: set memory size
« Reply #1 on: April 12, 2006, 11:59:55 am »
Normally you don't need that, only if you want to declare it as local var, since it is created on the stack. AFAIK you can alter the stack size with the $M directive
Personally I wouldn't use that large arrays on stack. What you can do is to use a dynarray for it:
Code: [Select]
var
  a: array of Single;
begin
  SetLength(a, 100000);
  ....
end;
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

mikta

  • Guest
re: set memory
« Reply #2 on: April 12, 2006, 08:53:03 pm »
Thank you Marc.  :)
Yes, it is local var. I make a technical calcul of digital terrain meassuring (many numbers and all need). I need set max stack size.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
RE: re: set memory
« Reply #3 on: April 13, 2006, 01:38:21 pm »
If you use dyn arrays in that case, you have way more mem available. Stack is limited on most OSes
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

kao

  • Newbie
  • Posts: 3
RE: re: set memory
« Reply #4 on: July 27, 2006, 07:16:19 pm »
Hi, can you explain how to use a dyn array??

I´m kinda new on this.

Thanx

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: RE: re: set memory
« Reply #5 on: July 27, 2006, 07:37:16 pm »
Quote from: "kao"
Hi, can you explain how to use a dyn array??


http://delphi.about.com/od/beginners/l/aa041800a.htm

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
RE: Re: RE: re: set memory
« Reply #6 on: July 28, 2006, 10:20:07 am »
You declare it as I gave in the sample
You use/access it like an normal array.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018