Newsgroups: comp.sys.transputer
From: gperkes@st.nepean.uws.edu.au (Graeme Perkes)
Subject: Re: 3LC *large* static arrays
Organization: University of Western Sydney, Nepean
Date: 15 Apr 1994 04:07:41 GMT
Message-ID: <2ol3ud$sj9@ob1.uws.EDU.AU>

Subject: Re: 3LC *large* static arrays
Newsgroups: comp.sys.transputer
References: <2oi0qt$hah@ob1.uws.EDU.AU>
Organization: University of Western Sydney, Nepean
Subject: Re: 3LC *large* static arrays
Newsgroups: comp.sys.transputer
References: <2oi0qt$hah@ob1.uws.EDU.AU>
Organization: University of Western Sydney, Nepean
X-Newsreader: TIN [version 1.2 PL1]
X-Newsreader: TIN [version 1.2 PL1]

I received the following reply from 3L. Dynamic allocation worked!!!

>Hi Graeme,
>
>:You wrote:
>:
>:I am having difficulty with tasks containing large static data structures.

[...]

> The problem is the way the compiler handles static data.
> A working copy is made at run time of all the program's static data.
> This allows multiple instances of the same task placed on the
> same processor to share code, but means that twice as much
> memory is used for static data as you would expect.
>
> The best thing to do is probably to allocate the memory
> dynamically, via malloc():
>
>     #define HistX (512)
>     #define HistY (512)
>
>     typedef int HISTOGRAM[HistX * HistY];
>
>     HISTOGRAM *dva_hist;
>
>     main()
>     {
>        dva_hist = malloc(sizeof(HISTOGRAM));
>        ...
>     }
>
>Remember that storage allocated by malloc() isn't automatically cleared
>to zero.
>
>Yours sincerely,
>
>
>Alan Culloch,
>support@threeL.co.uk

I used "calloc" and everything worked fine. In the config file I used the 
following line:

  task dva  ins=1 outs=1 stack=40k heap=1100k

Thanks to 3L for their help.

Regards,

--

 ,-_|\     Graeme Perkes (gperkes@st.nepean.uws.edu.au) =-=-=-=-=-=-=-=-=-=-=
/     \    Associate Lecturer           | PO Box 10      | Ph:  61 47 360437 
\_.--_/ <- Department of Computing      | Kingswood 2747 | Fax: 61 47 360770 

