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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:16:49+00:00 2026-05-27T15:16:49+00:00

After searching stackoverflow for an answer, I decided that the only problems that were

  • 0

After searching stackoverflow for an answer, I decided that the only problems that were treated was those regarding the extension of the maximum allowed memory. My question is if anyone knows how to insert a proper brake in case the scripts might fail due to the exhausting the memory.

This as for point A, also this in very close relation to another problem for which I failed to find an answer, meaning point B, and that is the time limit: another set of answers on how to extend the time limit using ini_set, and so on, possible solution were found by manually create break points in case the script already over-exceeded a proper time. And that was very fine, but having no control over a script you are loading might be impossible to prevent it.

Now, back to the question, does anyone know how to properly prevent such errors with a safe method? And if there really was an answered question regarding this subject, please link me to it.

Best regards,

  • 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-27T15:16:50+00:00Added an answer on May 27, 2026 at 3:16 pm

    The usual approach to reducing the amount of memory that a program might use is to break the problem into smaller pieces, iteratively refine answers, use files on disk in place of memory for structures, etc. Without knowing details of your application, it’s impossible to really suggest the best approach

    But consider the task of sorting a 100 megabyte input file in perhaps 100kb of memory space; you might think the task impossible without actually holding all 100 megabytes in memory at once. However, you can easily split this problem into smaller pieces in many different approaches:

    • perhaps sort all lines starting with integers 0-1000 into one file, 1001-2000 into another file, 2001-3000 into a third file, etc. Once all the lines are segregated into different files, sort each file, and then merge the input files with a simple concatenation.

    • perhaps sort the first 1000 lines at a time, store them into a temporary file, the next 1000 lines into another temporary file, and so on; then merge the output by selecting the lowest output from each file, outputting it, removing it from its file, and iterating.

    Consider the task of image editing: rather than loading an entire image into memory, you might read into memory only the portions you’re going to work on, do the operation, and immediately re-write the contents back to disk.

    Or, if your problem is a large regular expression match, you might have a significant backtracking problem where too much state is being stored at once. You could convert to different matching operators to prevent backtracking and perhaps solve the problem with multiple matches.

    It depends on the problem you’ve got to solve how you can break it into smaller pieces to reduce overall memory use. Note that many of these techniques can increase execution time, because they require more disk IO or re-solving problems that could have been kept in memory. Sometimes they speed up execution time because the less data you work with or keep, the better locality of reference, and the better the caching can work. (This is rare. See Programming Pearls for a very striking case of speed up due to simpler problem solving…)

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

Sidebar

Related Questions

After searching online and going through past stackoverflow posts for a suitable implementation for
I've run across an interesting PHP/SOAP error that has me stymied. After searching I
After searching stackoverflow.com I found several questions asking how to remove duplicates, but none
It appears after much searching that there seems to be a common problem when
I've been searching through StackOverflow and I'm wondering about some things regarding AdMob. I'm
After searching lot on the internet we have found following code to get only
First time posting here after having great results searching for other answers on stackoverflow.
After searching stackoverflow and Google for the past hour I thought I would ask.
I have a very tricky problem and after long searching (google, stackoverflow, ...) i
After searching for a while in books, here on stackoverflow and on the general

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.