Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8314087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:42:20+00:00 2026-06-08T20:42:20+00:00

I spotted the following behavior. Say I create the following multi-dimensional array: spam =

  • 0

I spotted the following behavior. Say I create the following multi-dimensional array:

spam = array(runif(96*48*60*360), dim = c(96,48,60,360))

It is quite predictable how much memory R should use for this, namely (96*48*60*360) * 4 bytes = 759.4 Mbyte. This is nicely confirmed using the lsos function (see this post):

> lsos()
         Type      Size PrettySize Rows Columns
spam    array 796262520   759.4 Mb   96      48
lsos function       776  776 bytes   NA      NA

R as a process however uses much more memory, roughly twice the size:

$ top | grep rsession
82:17628 hiemstra  20   0 1614m **1.5g** 8996 S  0.3 40.4   0:04.85 rsession  

Why does R do this? I assume the extra reserved memory is allocated to make it more quickly accessible to R? Any thought’s?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:42:24+00:00Added an answer on June 8, 2026 at 8:42 pm

    Because the garbage collector has not run yet.
    So there’s a lot of garbage, probably generated during the creation of the big array, that has to be cleared.

    If you force a garbage collection by calling gc() function, you will see that the used memory will be pretty near to the size of your array:

    > memory.size()
    [1] 775.96
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I've spotted a very disturbing issue. I've got the following python code: for
Being spotted in context of this question this seemingly inconsistent behavior can be reproduced
I've just spotted the following in the C99 ISO standard, 7.19.6.1 The fprintf function
I just spotted the following in an online tutorial. It showed 001 as a
I've just been browsing and spotted the following... When should you use a class
I have spotted a method in some code that does the following : def
I've just spotted the following page: Setting Conditional Formatting in Excel 2007 which is
I have to create now a multi-screen Silverlight 4 RIA application with MVVM. Each
I've got a real weird route behavior. I spotted the line which, i think,
I get the following error: org.dbpedia.spotlight.exceptions.ConfigurationException: Cannot find spotter file ../dist/src/deb/control/data/usr/share/dbpedia-spotlight/spotter.dict at org.dbpedia.spotlight.model.SpotterConfiguration.<init>(SpotterConfiguration.java:54) at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.