Re: error: size of variable is too large

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 :)


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux