From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) by kanga.kvack.org (Postfix) with ESMTP id 9D2EB6B0032 for ; Wed, 18 Sep 2013 20:25:06 -0400 (EDT) Received: by mail-pd0-f177.google.com with SMTP id y10so7729473pdj.22 for ; Wed, 18 Sep 2013 17:25:06 -0700 (PDT) References: <1379445730.79703.YahooMailNeo@web172205.mail.ir2.yahoo.com> Message-ID: <1379550301.48901.YahooMailNeo@web172202.mail.ir2.yahoo.com> Date: Thu, 19 Sep 2013 01:25:01 +0100 (BST) From: Max B Reply-To: Max B Subject: shouldn't gcc use swap space as temp storage?? In-Reply-To: <1379445730.79703.YahooMailNeo@web172205.mail.ir2.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-1007433603-216861906-1379550301=:48901" Sender: owner-linux-mm@kvack.org List-ID: To: "linux-mm@kvack.org" ---1007433603-216861906-1379550301=:48901 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =0A=0A=0A=0A=0A=0AHi All,=0A=0ASee below for executable program.=0A=0A=0ASh= ouldn't gcc use swap space as temp storage?=A0 Either my machine is set up = improperly, or gcc does not (cannot?) access this capability.=0A=0A=0AIt se= ems to me that programs should be able to access swap memory in these cases= , but the behaviour has not been confirmed.=0A=0ACan someone please confirm= or correct me?=0A=0A=0AApologies if this is not the correct listserv for t= he present discussion.=0A=0A=0AThanks for any/all help.=0A=0A=0ACheers,=0AM= ax=0A=0A=0A/*=0A=A0* This program segfaults with the *bar array declaration= .=0A=A0*=0A=A0* I wonder why it does not write the *foo array to swap space= =0A=A0* then use the freed ram to allocate *bar.=0A=A0*=0A=A0* I have explo= red the shell ulimit parameters to no avail.=0A=A0*=0A=A0* I have run this = as root and in userland with the same outcome.=0A=A0*=0A=A0* It seems to be= a problem internal to gcc, but may also be a kernel issue.=0A=A0*=0A=A0*/= =0A=0A#include =0A#include =0A=0A#define NMAX 628757505= =0A=0Aint main(int argc,char **argv) {=0A=A0 float *foo,*bar;=0A=0A=A0 foo= =3Dcalloc(NMAX,sizeof(float));=0A=A0 fprintf(stderr,"%9.3f %9.3f\n",foo[0],= foo[1]);=0A#if 1=0A=A0 bar=3Dcalloc(NMAX,sizeof(float));=0A=A0 fprintf(stde= rr,"%9.3f %9.3f\n",bar[0],bar[1]);=0A#endif=0A=0A=A0 return=0A 0;=0A} ---1007433603-216861906-1379550301=:48901 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable



Hi All,

<= /div>
= See below for executable program.

Shouldn't gcc use swap s= pace 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 corr= ect me?

Apologies if th= is is not the correct listserv for the present discussion.

Thanks for any/all help.

Cheers,
Ma= x


/* * 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 ha= ve 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 kerne= l issue.
 *
 */

#include <stdio.h>
#include= <stdlib.h>

#define NMAX 628757505

int main(int argc,ch= ar **argv) {
  float *foo,*bar;

  foo=3Dcalloc(NMAX,siz= eof(float));
  fprintf(stderr,"%9.3f %9.3f\n",foo[0],foo[1]);
#if 1
  bar=3Dcalloc(NMAX,sizeof(float= ));
  fprintf(stderr,"%9.3f %9.3f\n",bar[0],bar[1]);
#endif
<= br>  return=0A 0;
}



---1007433603-216861906-1379550301=:48901-- -- 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: email@kvack.org