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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:03:52+00:00 2026-05-11T04:03:52+00:00

I had been wondering for quite some time on how to manager memory in

  • 0

I had been wondering for quite some time on how to manager memory in my next project. Which is writing a DSL in C/C++.

It can be done in any of the three ways.

  1. Reference counted C or C++.
  2. Garbage collected C.
  3. In C++, copying class and structures from stack to stack and managing strings separately with some kind of GC.

The community probably already has a lot of experience on each of these methods. Which one will be faster? What are the pros and cons for each?

A related side question. Will malloc/free be slower than allocating a big chunk at the beginning of the program and running my own memory manager over it? .NET seems to do it. But I am confused why we can’t count on OS to do this job better and faster than what we can do ourselves.

  • 1 1 Answer
  • 2 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. 2026-05-11T04:03:52+00:00Added an answer on May 11, 2026 at 4:03 am

    It all depends! That’s a pretty open question. It needs an essay to answer it!

    Hey.. here’s one somebody prepared earlier:

    http://lambda-the-ultimate.org/node/2552

    http://www.hpl.hp.com/personal/Hans_Boehm/gc/issues.html

    It depends how big your objects are, how many of them there are, how fast they’re being allocated and discarded, how much time you want to invest optimizing and tweaking to make optimizations. If you know the limits of how much memory you need, for fast performance, I would think you can’t really beat grabbing all the memory you need from the OS up front, and then managing it yourself.

    The reason it can be slow allocating memory from the OS is that it deals with lots of processes and memory on disk and in ram, so to get memory it’s got to decide if there is enough. Possibly, it might have to page another processes memory out from ram to disk so it can give you enough. There’s lots going on. So managing it yourself (or with a GC collected heap) can be far quicker than going to the OS for each request. Also, the OS usually deals with bigger chunks of memory, so it might round up the size of requests you make meaning you could waste memory.

    Have you got a real hard requirement for going super quick? A lot of DSL applications don’t need raw performance. I’d suggest going with whatever’s simplest to code. You could spend a lifetime writing memory management systems and worrying which is best.

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

Sidebar

Related Questions

I have used the RhinoMocks product for quite some time and have been quite
I have been stuck on this for days, and was wondering if anyone had
I had been developing a console application, until our project needed a fancy UI
I've had a question that I've been wondering for a while. I'm making a
Until now, most of my PHP development had been done on a Mac in
I have been programming on iPhone for quite sometime and have had bad experiences
I've been coding for some time, and I always thought the linking phase of
I have been wondering about this, which is why I have put off learning
I had been wondering why my error page caused certain pages of my site
I had been working on a WPF project for a while, but haven't touched

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.