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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:07:09+00:00 2026-05-26T11:07:09+00:00

My application processes thousands of messages and uses dlopen / dlclose etc to call

  • 0

My application processes thousands of messages and uses dlopen / dlclose etc to call functions in shared libraries at runtime.

I have been analysing the memory at runtime and it seems (as I expected) that dlclose() does not free any malloc’ed memory after the close. So I have a rather bad memory leak….

The problem is these shared libs were written by someone else and I am not allowed to change the source. Is there any way around this? I suppose I could call a “subprocess” to process the message and then when it terminates the memory will dissappear for that subprocess….

Any other ideas?

Thanks for the help

Lynton

  • 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-26T11:07:10+00:00Added an answer on May 26, 2026 at 11:07 am

    It’s not clear from your question whether the memory “leaked” is memory allocated by the library you loaded, or by the dlopen implementation as part of managing the loaded libraries.

    If it’s allocated by the library, then either you are misusing the library and failing to call the right functions to instruct it to free memory it allocated, or it is poorly written and allocating (perhaps on first usage) data which it plans to keep around, reuse, and never free.

    If it’s allocated by the implementation of dlopen, then there’s nothing wrong; this just means dlopen decided it can’t safely unload the library, perhaps because there are still some references to its symbols hanging around. This is no problem since future loads of the same library will not consume more memory but will reuse the already-loaded copy.

    Now, assuming the problem is not that you’re misusing the library, all issues should be fixable simply by keeping the library open and not calling dlclose, and reusing it yourself if/when you need it next. That way, even if the library allocated memory behind your back and offers no way to free it, this will happen only once (the first time you load the library), not “N times”, and thus it is not a “memory leak”.

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

Sidebar

Related Questions

I have a C application running on Linux and it processes thousands of messages...but
I have a multi-process python application (processes are spawned by uwsgi) that needs to
I have an application that processes files in a directory and moves them to
We have a weblogic batch application which processes multiple requests from consumers at the
For instance, you have an application which processes files that are sent by different
All, I have a huge application that processes media files. I get 102% CPU
I'm working on an application that may generate thousands of messages in a fairly
I have a relatively large PHP-codebase (thousands of lines) for an application built with
We have a Windows Forms application that contains thousands of forms. Many of these
I'm currently working in a dispatcher service that processes thousands of messages delivered in

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.