Bug 146527 - C program cannot allocate enough on first Gnome login
C program cannot allocate enough on first Gnome login
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: pam (Show other bugs)
i686 Linux
medium Severity high
: ---
: ---
Assigned To: Tomas Mraz
Jay Turner
Depends On:
  Show dependency treegraph
Reported: 2005-01-28 20:45 EST by Humberto Yeverino
Modified: 2015-01-07 19:09 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-12-15 05:49:25 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Humberto Yeverino 2005-01-28 20:45:45 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041107 Firefox/1.0

Description of problem:
C program cannot allocate large amounts of memory on the first login
to Gnome, but works after a logout, login.

Begin Code----------------------

#include "stdlib.h"

#define ENTITY_COUNT 65530

typedef struct
   double number0;
   double number1;
   double number2;
   double number3;
   int* int_array;

   int          argc,
   const char** argv)
   double* real_array0;
   double* real_array1;
   double* real_array2;
   double* real_array3;
   double* real_array4;
   double* real_array5;
   double* real_array6;
   double* real_array7;
   Memory_Block* block_ptr;
   int block_count = 0;

   /* Allocate 8 arrays to simulate permanent entities. */
   real_array0 = (double*)calloc(sizeof(double), ENTITY_COUNT);
   real_array1 = (double*)calloc(sizeof(double), ENTITY_COUNT);
   real_array2 = (double*)calloc(sizeof(double), ENTITY_COUNT);
   real_array3 = (double*)calloc(sizeof(double), ENTITY_COUNT);
   real_array4 = (double*)calloc(sizeof(double), ENTITY_COUNT);
   real_array5 = (double*)calloc(sizeof(double), ENTITY_COUNT);
   real_array6 = (double*)calloc(sizeof(double), ENTITY_COUNT);
   real_array7 = (double*)calloc(sizeof(double), ENTITY_COUNT);

   while (block_count < 100000000)
      block_ptr = malloc(sizeof(Memory_Block));
      if (block_ptr)
          block_ptr->number0 = block_count;
          block_ptr->number1 = block_count;
          block_ptr->number2 = block_count;
          block_ptr->number3 = block_count;

          block_ptr->int_array = (int*)calloc(sizeof(int), 30000);

          if (block_count % 500 == 0)
             printf("Count %d\n", block_count);

End Code-----------------------------

A similar bug has been sent to caci.com where the program compiled
with thier library has problems allocating _after_ the first logout.
This does not occur when the program is run from a text console, only
when run under X. This is worse, but I was not able to create a simple
C program where this occurs.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Reboot
2. Login to Gnome
3. Run the C program 1 or more times
4. Logout
5. Login
6. Run the C program

Actual Results:  On step 3, the program failed to malloc after
allocating a small amount of system memory.

On step 6, the program allocates alll available memory before the
malloc fails.

Expected Results:  The program should always behave as it does in step 6

Additional info:

Run under SMP and single processor kernels, with the latest patches
from RHN.

The machine is a dual processor AMD Athlon MP.
Comment 2 Tomas Mraz 2005-09-08 14:09:14 EDT
What does 'ulimit -a' say in the first and in the second case?
Comment 3 Tomas Mraz 2005-12-15 05:49:25 EST
Since there are insufficient details provided in this report for us to
investigate the issue further, and we have not received the feedback we
requested, we will assume the problem was not reproduceable or has been fixed in
a later update for this product.

Users who have experienced this problem are encouraged to upgrade to the latest
update release, and if this issue is still reproduceable, please contact the Red
Hat Global Support Services page on our website for technical support options:

If you have a telephone based support contract, you may contact Red Hat at
1-888-GO-REDHAT for technical support for the problem you are experiencing.

Note You need to log in before you can comment on or make changes to this bug.