public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* error: size of variable  is too large
@ 2007-11-02  9:22 Sivaprasad.pv
  2007-11-13 21:13 ` Matthew Woehlke
  0 siblings, 1 reply; 2+ messages in thread
From: Sivaprasad.pv @ 2007-11-02  9:22 UTC (permalink / raw)
  To: gcc

Hi all,
 
while compiling our application using cross compiler,following error was 
occurred.

 error: size of variable `a_var' is too large

where 'a_var' is structure variable(It is around 2MB of size).

I want to know Is there any limit for variable size.Is it depend on 
particular target to which gcc is ported.
please help me in order to resolve this issue.

--P.V.Siva Prasad





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: error: size of variable  is too large
  2007-11-02  9:22 error: size of variable is too large Sivaprasad.pv
@ 2007-11-13 21:13 ` Matthew Woehlke
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Woehlke @ 2007-11-13 21:13 UTC (permalink / raw)
  To: gcc-help

Sivaprasad.pv wrote:
> while compiling our application using cross compiler,following error was 
> occurred.
> 
> error: size of variable `a_var' is too large
> 
> where 'a_var' is structure variable(It is around 2MB of size).
> 
> I want to know Is there any limit for variable size.Is it depend on 
> particular target to which gcc is ported.
> please help me in order to resolve this issue.

If allocated on the stack, an allocation that exceeds the stack size 
will cause your program to SEGV at runtime. It may be that gcc 
additionally refuses to compile code that statically allocates a "large" 
amount of stack space (for some definition of "large").

It sounds like you are trying to allocate a ~2 MiB struct on the stack. 
Consider using malloc() (and of course, remember to free()) instead. 
Allowable stack allocation on POSIX systems is determined by the 
ulimit/rlimit; default values for this vary by platform, system 
configuration, and potentially even users' login profiles.

-- 
Matthew
Me: wtf?? "#warning This is temporary since Dec 2000". Seven-year 
"temporary" code?
Mathieu Chouinard: Sounds like the correct definition of temporary :)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-13 20:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-02  9:22 error: size of variable is too large Sivaprasad.pv
2007-11-13 21:13 ` Matthew Woehlke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).