From: Vladimir Murzin <murzin.v@gmail.com>
To: Max B <txtmb@yahoo.fr>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: shouldn't gcc use swap space as temp storage??
Date: Thu, 19 Sep 2013 06:14:55 +0200 [thread overview]
Message-ID: <20130919041451.GA2082@hp530> (raw)
In-Reply-To: <1379550301.48901.YahooMailNeo@web172202.mail.ir2.yahoo.com>
On Thu, Sep 19, 2013 at 01:25:01AM +0100, Max B wrote:
>
>
>
>
>
>
> Hi All,
>
> See below for executable program.
>
>
> Shouldn't gcc use swap space as temp storage?? Either my machine is set up improperly, or gcc does not (cannot?) access this capability.
>
>
> It seems to me that programs should be able to access swap memory in these cases, but the behaviour has not been confirmed.
>
> Can someone please confirm or correct me?
>
It is not because your machine settings or gcc. Your code is buggy.
>
> Apologies if this is not the correct listserv for the present discussion.
>
I think the proper list for C related questions is linux-c-programming or similar.
Vladimir
>
> Thanks for any/all help.
>
>
> Cheers,
> Max
>
>
> /*
> ?* This program segfaults with the *bar array declaration.
> ?*
> ?* I wonder why it does not write the *foo array to swap space
> ?* then use the freed ram to allocate *bar.
> ?*
> ?* I have explored the shell ulimit parameters to no avail.
> ?*
> ?* I have run this as root and in userland with the same outcome.
> ?*
> ?* It seems to be a problem internal to gcc, but may also be a kernel issue.
> ?*
> ?*/
>
> #include <stdio.h>
> #include <stdlib.h>
>
> #define NMAX 628757505
>
> int main(int argc,char **argv) {
> ? float *foo,*bar;
>
> ? foo=calloc(NMAX,sizeof(float));
> ? fprintf(stderr,"%9.3f %9.3f\n",foo[0],foo[1]);
> #if 1
> ? bar=calloc(NMAX,sizeof(float));
> ? fprintf(stderr,"%9.3f %9.3f\n",bar[0],bar[1]);
> #endif
>
> ? return
> 0;
> }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-09-19 4:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 19:22 does gcc segfault when main memory is overfull? Max B
2013-09-19 0:25 ` shouldn't gcc use swap space as temp storage?? Max B
2013-09-19 4:14 ` Vladimir Murzin [this message]
2013-09-21 3:13 ` Max B
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130919041451.GA2082@hp530 \
--to=murzin.v@gmail.com \
--cc=linux-mm@kvack.org \
--cc=txtmb@yahoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).