AFAIK when you use static tables they are allocated on the stack.
You might want to try allocating them on the heap...

To do so, simply use malloc().

  char *a;
  a = malloc(8192);
  if (a == NULL) return(1);
  /* do your stuff */
  free(a);
  return(0);

cheers,
Mateusz




On 12/20/2012 07:24 PM, Santiago Almenara wrote:
> Hello list:
>
> I am having Stack Overflow problems with this simple code under FreeDOS
> and OpenWatcom:
>
> #include <stdio.h>
>
> char a[8192];
>
> int main()
> {
>      int i;
>      char b[8192];
>      for(i=0; i<8192; i++) a[i]=b[i]=0;
>      return 0;
> }
>
> I keep getting stack overflow problems.
>
> I know this code is very simple and meaningless, but it's an example of
> how I am having stack overflow problems with static arrays of size 8192.
>
> Excuse me if the mail is too off-topic, but I think the problem is
> something to do with memory.
>
> Thanks,
>
> Santiago
>
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
>
>
>
> _______________________________________________
> Freedos-user mailing list
> Freedos-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-user
>


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to