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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:37:40+00:00 2026-05-14T02:37:40+00:00

I have a Linux app (written in C) that allocates large amount of memory

  • 0

I have a Linux app (written in C) that allocates large amount of memory (~60M) in small chunks through malloc() and then frees it (the app continues to run then). This memory is not returned to the OS but stays allocated to the process.

Now, the interesting thing here is that this behavior happens only on RedHat Linux and clones (Fedora, Centos, etc.) while on Debian systems the memory is returned back to the OS after all freeing is done.

Any ideas why there could be the difference between the two or which setting may control it, etc.?

  • 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-14T02:37:40+00:00Added an answer on May 14, 2026 at 2:37 am

    I’m not certain why the two systems would behave differently (probably different implementations of malloc from different glibc’s). However, you should be able to exert some control over the global policy for your process with a call like:

    mallopt(M_TRIM_THRESHOLD, bytes)
    

    (See this linuxjournal article for details).

    You may also be able to request an immediate release with a call like

    malloc_trim(bytes)
    

    (See malloc.h). I believe that both of these calls can fail, so I don’t think you can rely on them working 100% of the time. But my guess is that if you try them out you will find that they make a difference.

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

Sidebar

Related Questions

i have written a small codeigniter test app that is currently running on my
We have a linux app that depends on the speed with which the user
I have a Linux/c client app that connects to a WCF web service over
My problem is this: I have a C/C++ app that runs under Linux, and
I have written a C utility for Linux that checks the contents of /proc/net/dev
I have a C app that generates very large binary files, each about 30GB.
I have a server client app written in C++ on Linux. When a client
I have an app that I've written in C#/WinForms ( my little app ).
I have an embedded Linux app that writes to a file at a fairly
I have written an (obviously) excellent tool in python (under linux) that I would

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.