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

  • Home
  • SEARCH
  • 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 9179263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:45:18+00:00 2026-06-17T17:45:18+00:00

In my C program, I create a child process and in it, it parses

  • 0

In my C program, I create a child process and in it, it parses a string and created a pointer array (using malloc()) for the use of passing it in execvp() command.

But the problem is, how do you free the memory that the child created? execvp() runs the new task and may or may not return. If it doesn’t return, then it was successful and the child dies (and I can’t really use the free() command). If it failed then it returned, then it continues doing the next lines of code, is this the only chance to free the memory?

  • 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-06-17T17:45:20+00:00Added an answer on June 17, 2026 at 5:45 pm

    You don’t need to. Specifically, if you allocate memory in a process before an exec()-type routine (e.g., execvp() in your case) is called, all of the memory associated with the original executable is released. It’s a similar situation to a process exiting (and having all its resources released), and a new process being started with a clean slate.

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

Sidebar

Related Questions

So I have a program which creates a child process and executes a command
Here's what my program is supposed to do: create 4 child processes: process 0
consider the following: a parent process with a child child runs another program using
I wrote a little program using fork to create new processes which use pipe
I have a program that uses fork() to create a child process. I have
I have to write program that create process using pipe() . My first task
This program will create a child process, the child process will wait for an
I have a simple program (in C) that create two child process, wait on
My Windows XP/7 program launches a child process using the Windows API CreateProcess() function
I need to create program that creates a XML schema like below using System.Xml.XmlSchema

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.