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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:20:39+00:00 2026-05-27T16:20:39+00:00

I have 2 questions concerns about using shared memory. I’m using CreateFileMapping to create

  • 0

I have 2 questions concerns about using shared memory. I’m using CreateFileMapping to create a shared memory area between two processes.

1) I understand that I need to call CloseHandle on every handle returned from a CreateFileMapping or OpenFileMapping call in order to release the memory. My question is, do all handles get closed appropriately and mem deallocated by Windows XP/7 if the programs using the shared memory exit without calling CloseHandle? IE – is there a possibility of a mem leak after all processes using the mem have been closed?

2) I use MapViewofFile to get a pointer to the mem. In 1 instance I’ve assumed that the shared memory will always exist in the context of a method. So I’ve saved the return value of MapViewOfFile as a pointer and closed the handle to the mem and am just using the pointer to the shared mem (but still locking access to it). Is this safe, or should I call MapViewOfFile every time I access the shared mem?

Thanks,

Ian

  • 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-27T16:20:40+00:00Added an answer on May 27, 2026 at 4:20 pm

    1) Yes, all handles are closed when a process terminates, no matter if it dies or finishes nicely. No leaks here.

    2) As long as you don’t call UnmapViewOfFile, the memory will still be accesible to the process, even if the handle has been closed:

    Although an application may close the file handle used to create a file mapping object, the system holds the corresponding file open until the last view of the file is unmapped

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

Sidebar

Related Questions

I have some questions about basic CSS that I was unable to understand or
I have questions about System.Threading.ThreadStart Class : where can I find its specifications (
I have some questions about customers about NF mode for DB2. Google had very
I have two questions: 1) How can I make an array which points to
I have some questions about multi-threaded programming and multi-core usage. In particular I'm wondering
I have two questions. Do realloc() and memcpy() copy the entries in an array
Using Sql Server 2005. I have a long running update that may take about
I have read the other questions and they mostly talk about the security of
I love the flexibility of named branches but I have some concerns about the
Good morning. As the title indicates, I've got some questions about using python for

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.