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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:40:46+00:00 2026-05-25T03:40:46+00:00

A chapter out of the book I have been reading has focused on memory

  • 0

A chapter out of the book I have been reading has focused on memory management allocating space using malloc linux functions.

Before I read this I would make relatively small programs without allocating space.

Is it acceptable to not do anything in the way of memory allocation for applications whose memory footprint remains under 50MB? What are the repercussions of not doing so?

  • 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-05-25T03:40:47+00:00Added an answer on May 25, 2026 at 3:40 am

    If you can do without malloc for small applications, you’re probably just not needing to use any heap space. Little utility programs or toy programs often don’t. The things you might be doing wrong though to get by when you should be using the heap are:

    1. Arrays. If you find yourself allocating large arrays ‘just to make sure everything fits’ then you should perhaps be using malloc. At the least, handle the error condition that everything overflows to check they really are big enough. With dynamically allocated arrays, you can make bigger ones on the fly if you find you need more space.

    2. Doing too much recursion. C benefits from flattening out recursion sometimes into loops over arrays, because unlike function languages it can’t optimise things properly. If you are getting your storage space by calling function lots to create it, that’s pretty dangerous (the program might crash on you one day).

    3. Using static pools of objects (structs, classes). Perhaps you have a ring buffer, and 15 objects that could be in it, and you have them statically allocated because you know that your buffer will never have more than 15 entries. That’s kind of OK, but allowing the buffer to grow more by adding in more structs, created with malloc, might be nice.

    Probably plenty more situations where programmes which don’t need malloc could benefit from having it added.

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

Sidebar

Related Questions

I am currently learning Assembly language on Linux. I have been using the book
So I've been reading through the K&R C book and have a question.. in
Im reading Jon Skeet book. ( Expression Trees Chapter) It has an example of
I'm doing the first chapter exercises on my Java book and I have been
I'm reading the 7 Languages in 7 Days-book, and have reached the Prolog chapter.
I am new to cakephp and have been working through the Apress book Beginning
I have two content types, book and chapter. Each chapter node contains a node
I have a tree like structure created out of models using ForeignKey linkages. As
I have followed the Django Book up until chapter seven, and I am currently
I'm reading through Hartl's book, Ruby on Rails by Example. In chapter 11, it

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.