Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Virtual Memory Exhausted error

38 views
Skip to first unread message

John

unread,
Jun 26, 2008, 1:42:26 PM6/26/08
to
Using Lynx40 on a MVME761-001 that boots from the network.

I'm getting a Virtual memory exhausted error when compiling using gcc.

The code where the error occurrs goes something like this

unsigned char MyStuff[] = {

#include "filename"

}

The filename is a large file, approx. 600 mb. If I shorten the file to
around 200 MB, the source code compiles with no errors.
The file is a comma delimited file where each data is an unsigned
char field.

Anybody have any ideas?

Steve Watt

unread,
Jun 26, 2008, 6:27:46 PM6/26/08
to
In article <q7l764tm2qbgh1q2t...@4ax.com>,

John <jvas...@cox.net> wrote:
>Using Lynx40 on a MVME761-001 that boots from the network.
>
>I'm getting a Virtual memory exhausted error when compiling using gcc.

Add more memory?

>The code where the error occurrs goes something like this
>
>unsigned char MyStuff[] = {
>
>#include "filename"
>
>}
>
>The filename is a large file, approx. 600 mb. If I shorten the file to
>around 200 MB, the source code compiles with no errors.
>The file is a comma delimited file where each data is an unsigned
>char field.
>
>Anybody have any ideas?

More usefully, instead of running 600MB of ASCII to produce ~125MB or
so of data, create the file in binary, use objcopy to convert it into
an elf file. For some more hints, see
http://sourceware.org/ml/binutils/2002-02/msg00846.html
and some of the messages around it.
--
Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.5" / 37N 20' 15.3"
Internet: steve @ Watt.COM Whois: SW32-ARIN
Free time? There's no such thing. It just comes in varying prices...

John

unread,
Jun 26, 2008, 6:54:09 PM6/26/08
to
On Thu, 26 Jun 2008 22:27:46 +0000 (UTC), Steve Watt
<steve.re...@Watt.COM> wrote:

>In article <q7l764tm2qbgh1q2t...@4ax.com>,
>John <jvas...@cox.net> wrote:
>>Using Lynx40 on a MVME761-001 that boots from the network.
>>
>>I'm getting a Virtual memory exhausted error when compiling using gcc.
>
>Add more memory?
>
>>The code where the error occurrs goes something like this
>>
>>unsigned char MyStuff[] = {
>>
>>#include "filename"
>>
>>}
>>
>>The filename is a large file, approx. 600 mb. If I shorten the file to
>>around 200 MB, the source code compiles with no errors.
>>The file is a comma delimited file where each data is an unsigned
>>char field.
>>
>>Anybody have any ideas?
>
>More usefully, instead of running 600MB of ASCII to produce ~125MB or
>so of data, create the file in binary, use objcopy to convert it into
>an elf file. For some more hints, see
> http://sourceware.org/ml/binutils/2002-02/msg00846.html
>and some of the messages around it.

I'll check into that.

The #include "filename" will read the file into memory as a binary
file. No need to convert. I took a look at the code that processes
the array and it's treating the array as containing binary data. The
data is read and then written to a hardware register.

Brandon

unread,
Jun 27, 2008, 7:47:51 AM6/27/08
to
On Jun 26, 6:54 pm, John <jvasq...@cox.net> wrote:
> On Thu, 26 Jun 2008 22:27:46 +0000 (UTC), Steve Watt
>
>
>
> <steve.removet...@Watt.COM> wrote:
> >In article <q7l764tm2qbgh1q2tpvijbvubupo587...@4ax.com>,

> >John <jvasq...@cox.net> wrote:
> >>Using Lynx40 on a MVME761-001 that boots from the network.
>
> >>I'm getting a Virtual memory exhausted error when compiling using gcc.
>
> >Add more memory?
>
> >>The code where the error occurrs goes something like this
>
> >>unsigned char MyStuff[] = {
>
> >>#include "filename"
>
> >>}
>
> >>The filename is a large file, approx. 600 mb. If I shorten the file to
> >>around 200 MB, the source code compiles with no errors.
> >>The file is a comma delimited file where each data is an unsigned
> >>char field.
>
> >>Anybody have any ideas?
>
> >More usefully, instead of running 600MB of ASCII to produce ~125MB or
> >so of data, create the file in binary, use objcopy to convert it into
> >an elf file. For some more hints, see
> >http://sourceware.org/ml/binutils/2002-02/msg00846.html
> >and some of the messages around it.
>
> I'll check into that.
>
> The #include "filename" will read the file into memory as a binary
> file. No need to convert. I took a look at the code that processes
> the array and it's treating the array as containing binary data. The
> data is read and then written to a hardware register.

Try increasing the size of your swap file or partition. The OS is
telling you that it doesn't have any more. You can designate a file as
swap as well. Increasing your regular memory will help. Usually you
see that error when you forget to enable a swap file at all, or you
are running completely out of memory. What WILL help is compression,
if you have the processing time. If you can compress the data, and
reduce the size of the file you might see some speed increases as
well. Obviously this means some code changes, and importing zlib or
some-such. What I mean is compress each field, but you certainly could
compress the entire file, read it in, then write some code to
reallocate the data as an array like you have it.
The easiest fix is to add more swap.

John

unread,
Jun 27, 2008, 3:21:28 PM6/27/08
to

The problem was fixed by typing
ulimit -d 100000
before compiling the program.


0 new messages