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 9269979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:15:29+00:00 2026-06-18T15:15:29+00:00

i cant see why this struct takes up 96 bytes of ram. struct cell

  • 0

i cant see why this struct takes up 96 bytes of ram.

struct cell
{
    bool filled;
    bool isParent;
    short int mat;
    bool cx,cy,cz;
    vect norm;
    struct cell* child[8];
    struct cell* parent;
    cell(float pxx=0, float pyy=0, float pzz=0, float ss=0, cell *par=NULL, bool cxx=0, bool cyy=0, bool czz=0);

    void open_read(string);
};

I know about word allignment, but this should atleast not be more than 64 bytes i think…
there will be many millions of instances of this struct so how could i get the memory footprint to a minimum?
I am using linux and vect is a vector(3 floats)

  • 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-18T15:15:30+00:00Added an answer on June 18, 2026 at 3:15 pm

    There’s not much you can do about your pointers.

    However, you can condense all your booleans down to a single byte by using either single-bit enumerators or bitfields. Depending on the maximum value of mat, you may be able to condense the flags AND that value into two bytes. It’s not a big saving.

    If you expect your tree to be extremely dense, you may get significant gains by allocating your children as a pool. That is, you have a single struct cell* child pointer which references a block of memory that is an array of all eight children. Then you save the space of 7 pointers per record with the understanding that every non-leaf node will allocate more memory than it requires. And you probably need a flag to indicate the node is empty.

    Alternatively, you could chain your children as a list if you want to sacrifice the random-access of an array. Then you just need a single child pointer and a single sibling pointer. A saving of 6 pointers per node and no wastage from pooling. It gets a bit finnicky though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably something really simple but I cant see what! Any images I
I have been looking over this code for the past hour, I cant see
Okay, I know this is a Noob question but I cant see to get
What I want to happen is for the pushFront(int) function to do this: bool
So, I tried doing something like this : void place(struct node * list, int
So I've got this. #define MAX_MENU_OPTIONS 1 typedef struct _NEW_MENU_OPTION { char* name; int
I can't see this in the docs, but I presume it's a solved problem.
I can't see why this won't work. I am performing lstrip() on the string
I can't see a clear mistake in this code. Instead of validating my fields,
I just can't see what's wrong with this code.. it seems to be the

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.