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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:15:42+00:00 2026-05-19T03:15:42+00:00

I have a program that runs fine on MacOS and Linux and cross-compiles to

  • 0

I have a program that runs fine on MacOS and Linux and cross-compiles to Windows with mingw. Recently I made the program multi-threaded.

The current design of the program has memory allocated in the main thread and freed in the slave “worker” threads. That’s not a problem on MacOS and Linux because the malloc/free system is multi-threaded.

I’m concerned about the cross-compiling, however. The version of mingw that I’m using is built from MacOS ports. It’s a pretty ancient version of G++ (version 3.4.5) from 2004. I’ve been unsuccessful in my attempts to build a more recent version (I’d like to build a 64-bit version, but gave up). I’m getting pthreads from http://sourceware.org/pthreads-win32.

My concern is that the malloc & free system in 3.4.5 is not multi-threaded.

Questions:

  1. Should I rewrite my program so that the blocks of memory to be freed are passed back to the main thread to be freed there?

  2. Should I try to upgrade to a more recent mingw?

  3. Is there any way to find these concurrency problems other than massive amounts of testing? That just doesn’t feel good to me.

Thanks!

  • 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-19T03:15:42+00:00Added an answer on May 19, 2026 at 3:15 am

    Why do you say malloc & free are not multithreaded?

    mingw32 by default will link with msvcrt.dll which is a multithread dll. See [1]. There was[2] a single-threaded library provided by Microsoft, but it was only available for static linking.

    PS: You mention that you are cross-compiling but you seem instead to be compiling the windows program in windows. In such case, Why don’t you dowload the binaries from http://www.mingw.org? (it’s a pain to figure out in their downloads the files needed, though)

    1- http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=VS.71%29.aspx

    2- See [1]. Removed in Visual Studio 2005 http:// msdn.microsoft.com/en-us/library/abx4dbyh%28v=VS.80%29.aspx

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

Sidebar

Related Questions

I have a cross platform program that runs on Windows, Linux and Macintosh. My
I have a program that runs osql.exe from microsoft sql server tools directory and
I have a Visual Studio 2005 C++ program that runs differently in Release mode
I have a PHP script that runs as a CGI program and the HTTP
I have a bash script that runs a simulation program written in Fortran 90,
I have a program that creates a Windows user account using the NetUserAdd() API
I have a program that spits out both standard error and standard out, and
I have a program that uses the mt19937 random number generator from boost::random. I
I have a program that spits out an Excel workbook in Excel 2003 XML
I have a program that monitors debug messages and I have tried using a

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.