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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:28:14+00:00 2026-06-08T20:28:14+00:00

Is it possible to clear all resources in PHP? I know that you can

  • 0

Is it possible to clear all resources in PHP?

I know that you can get all defined functions with get_defined_vars
with unset you can easily clear these resources.

But that’s not enough for me. I have a script that runs a long time (~1h 30m) to execute many functions.. but while the executions the script collected informations that don’t matter anymore.. the script exports products and get around 0.2MB – 0.5MB for each product (3200 products)

That is more than 600mb of memory usage. I optimized the script as good as I can, but I don’t get it smaller.

I is possible to get all included files with get_included_files or get_declared_classes; is it possible to clear these infos? Remove the classes (except some required like autoloader classes) or other included files so that I can free more RAM?

Or do you know other ways to optimize the server usage while execution?

Maybe it’s a stupid question, but I would be happy for each hint to improve the performance of the PHP script.

Info of the script environment: the script runs on an old Magento version 1.4 that has huge problems with the cache and performance; an update to a newer version is at the moment not possible.

  • 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-08T20:28:16+00:00Added an answer on June 8, 2026 at 8:28 pm

    We had a script that consumed up to 2GB of memory, and leaked memory like crazy (it uses Doctrine 1.1).

    After unset()ing as much as we could, we then added gc_enable() to the top of the script, and gc_collect_cycles() in strategic locations.

    This did help with reclaiming some of the used memory, but did slow the script down by a small amount.

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

Sidebar

Related Questions

Possible Duplicate: What's the best way to delete all data from a table? Clear
Is it possible to clear a Flex flash.utils.Dictionary ? I have a Dictionary that
Is it possible to clear a listener that I put on my JPanel ?
I would like to know if its possible to clear the current information stored
I'd like to know whether it's possible to clear the NTFS dirty bit in
I know that when delete [] will cause destruction for all array elements and
I would like to know if it is at all possible, and if so
I know all internal jQuery functions are written in JavaScript, so it should technically
Is it possible to clear all site cache? I would like to do this
is it possible to clear all textboxes in HTML by calling a javascript function

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.