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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:21:00+00:00 2026-05-28T14:21:00+00:00

In PHP, I’m using an in-memory (or rather, temp in-memory) file to load an

  • 0

In PHP, I’m using an in-memory (or rather, temp in-memory) file to load an image from an external URL into a GD resource:

$file = 'php://temp/img';
copy($uri, $file);
$src_img = @imagecreatefromjpeg($file);

However, as I understand it, this file remains in memory, even though I have no use for it after imagecreatefromjpeg().

Is there a way to free memory used by a php://temp wrapper file?

Or atleast signal that the file is no longer used?

  • 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-28T14:21:01+00:00Added an answer on May 28, 2026 at 2:21 pm

    When you create a file in php://temp (or php://memory for that matter) the resource only lasts the lifetime of the script. If you open the file using fopen() to get a resource handle, the lifetime can be shortened using fclose($resource_handle).

    In your case, as soon as your script is done executing, the file will no longer be in memory.

    In the circumstance where you would like to clear the memory prior to script completion, all you have to do is fclose() the resource file pointer.

    On another note, the /img you are using is invalid and is being ignored. The only added data that is recognized is /maxmemory:n.

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

Sidebar

Related Questions

PHP puts the session id into the URL when cookies are turned off. Does
PHP seems to use a rather annoying method for setting the evnironment timezone, using
PHP stores its session information on the file system of the host of the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
PHP Fatal error: Out of memory (allocated 26214400) (tried to allocate 9175041 bytes) in
Php doesn't load extensions specified through php.ini php -v doesn't give any errors or
php gives the ability to send arrays from the _GET. example: test.php?var1=abc&arr[0]=1&arr[3]=test will output:
‘php.exe’ is not recognized as an internal or external command, operable program or batch

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.