Search Results

Search found 12267 results on 491 pages for 'out of memory'.

Page 26/491 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • What are some Java memory management best practices?

    - by Ascalonian
    I am taking over some applications from a previous developer. When I run the applications through Eclipse, I see the memory usage and the heap size increase a lot. Upon further investigation, I see that they were creating an object over-and-over in a loop as well as other things. I started to go through and do some clean up. But the more I went through, the more questions I had like "will this actually do anything?" For example, instead of declaring a variable outside the loop mentioned above and just setting its value in the loop... they created the object in the loop. What I mean is: for(int i=0; i < arrayOfStuff.size(); i++) { String something = (String) arrayOfStuff.get(i); ... } versus String something = null; for(int i=0; i < arrayOfStuff.size(); i++) { something = (String) arrayOfStuff.get(i); } Am I incorrect to say that the bottom loop is better? Perhaps I am wrong. Also, what about after the second loop above, I set "something" back to null? Would that clear out some memory? In either case, what are some good memory management best practices I could follow that will help keep my memory usage low in my applications? Update: I appreciate everyones feedback so far. However, I was not really asking about the above loops (although by your advice I did go back to the first loop). I am trying to get some best practices that I can keep an eye out for. Something on the lines of "when you are done using a Collection, clear it out". I just really need to make sure not as much memory is being taken up by these applications.

    Read the article

  • COM C# Memory leak Tracing

    - by maxfridbe
    Is there a way to find out the memory usage of each dll within a c# application using com dll's? Or what would you say is the best way to find out why memory grows exponentially when using a com object (IE. Whether the COM object has a memory leak, or whether some special freeing up of objects passed to managed code has to occur(and/or how to do that)).

    Read the article

  • Memory Allocation Profiling in C++

    - by Amit Kumar
    I am writing an application and am surprised to see its total memory usage is already too high. I want to profile the dynamic memory usage of my application: How many objects of each kind are there in the heap, and which functions created these objects? Also, how much memory is used by each of the object? Is there a simple way to do this? I am working on both linux and windows, so tools of any of the platforms would suffice. NOTE: I am not concerned with memory leaks here.

    Read the article

  • Stack memory in Android

    - by Matt
    I'm writing an app that has a foreground service, content provider, and a Activity front end that binds to the service and gets back a List of objects using AIDL. The service does work and updates a database. If I leave the activity open for 4-8+ hours, and go to the "Running Services" section under settings on the phone (Nexus One) an unusually large amount of memory being used is shown (~42MB). I figure there is a leak. When I check the heap memory i get Heap size:~18MB, ~2MB allocated, ~16MB free. Analyzing the hprof in Eclipse MAT seems fine, which leads me to theorize that memory is leaking on the stack. Is this even possible? If it is, what can I do to stop or investigate the leak? Is the reported memory usage on the "Running Services" section of android even correct (I assume it is)? Another note: I have been unable to reproduce this issue when the UI is not up (with only the service running)

    Read the article

  • Silverlight 4 seems like starving of memory

    - by Marco
    I have been playing a bit with Silverlight and try to port my Silverlight 3.0 application to Silverlight 4.0. My application loads different XAP files and upon a user request create an instance of a Xaml user control and adds it to the main container, in a sort of MEF approach in order I can have an extensible and pluggable application. The application is pretty huge and to keep acceptable the performances and the initial loading I have built up some helper classes to load in the background all pages and user controls that might be used later on. On Silverlight 3.0 everything was running smoothly without any problem so far. Switching to SL 4.0 I have noticed that when the process approaches to create the instances of the user controls the layout freezes unexpectedly for a minute and sometimes for more. Looking at the task manager the memory usage of IE jumps from 50MB to 400MB and sometimes up to 1.5 GB. If the process won't take that much the layout is rendered properly even though the memory usage is still extremely high. Otherwise everything crashes due to out of memory exception. Running the same application compiled in SL3, the memory used is about 200MB when all the usercontrols are loaded. Time spent to load the application in SL3 is about 10 seconds, while it takes up to 3 mins in SL4 There are no transparencies, no opacities set, no effects and animations in the layout. User controls are instantied on the fly and added or removed in the visual tree on purpose when the user switches from one screen to another. The resources are all cleaned properly when a usercontrol is removed from the visual tree to allow the GC to operate in the background. I may do something wrong but I could not figure out where exactly nail out the source of this problem. As far as I know there is no memory profiler in SL4 that can help me out to find where to look at. But again I could not be updated on new debugging tools available.

    Read the article

  • Objective-C memory leak in loading remote content

    - by Ican Zilb
    I try to load a plist file from my server. I can think of 2 ways to do that, but for both Instruments says there's huge memory leak : NSData* plistData = [NSData dataWithContentsOfURL:url]; and NSDictionary* updateDigest = [NSDictionary dictionaryWithContentsOfURL: [NSURL URLWithString:updateURL] ]; The backtrace of the memory leak leads to __CFURLCache in CFNetwork and I am wondering if something can be done to fix the leak? Any other way to load a remote plist xml, without the memory leakage ? Thanks

    Read the article

  • Why can .NET not have memory leaks?

    - by Dinah
    Ignoring unsafe code, .NET cannot have memory leaks. I've read this endlessly from many experts and I believe it. However, I do not understand why this is so. It is my understanding that the framework itself is written in C++ and C++ is susceptible to memory leaks. Is the underlying framework so well-written, that it absolutely does not have any possibility of internal memory leaks? Is there something within the framework's code that self-manages and even cures its own would-be memory leaks? Is the answer something else that I haven't considered?

    Read the article

  • Objective-C Memory Management: When do I [release]?

    - by Sahat
    I am still new to this Memory Management stuff (Garbage Collector took care of everything in Java), but as far as I understand if you allocate memory for an object then you have to release that memory back to the computer as soon as you are finished with your object. myObject = [Object alloc]; and [myObject release]; Right now I just have 3 parts in my Objective-C .m file: @Interface, @Implementation and main. I released my object at the end of the program next to these guys: [pool drain]; return 0; But what if this program were to be a lot more complicated, would it be okay to release myObject at the end of the program? I guess a better question would be when do I release an object's allocated memory? How do I know where to place [myObject release];?

    Read the article

  • imagejpeg memory exhaustion

    - by 0plus1
    I'm creating thumbnails cycling through a lot of images, when I find a large image I get: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 13056 bytes) Now I already know how to circumvent this with: ini_set('memory_limit', '-1'); What I want to know is why it exhaust the memory! Is there some debug tools that will show me exactly when memory is exhausting? And specifically that will show me if there are variables/arrays that are killing my memory? OR, are there better way to resize images other then: $thumb=imagecreatetruecolor($newwidth,$newheight); $source=imagecreatefromjpeg($imgfile); imagecopyresampled($thumb,$source,0,0,0,0,$newwidth,$newheight,$width,$height); imagejpeg($thumb,$destinationfile,85); ? Thank you very much!

    Read the article

  • Solving iPhone/iPad out of memory issues

    - by Joonas Trussmann
    I have a strange issue where I'm scrolling through a paged UIScrollView which displays the pages of a PDF document (using Quartz 2D and CATiledLayer). When I page through memory allocation looks fine with it going up with a few initial pages and then keeping it steady as it obviously releases the memory kept for earlier pages. Upon hitting page x (not a certain PDF page or a certain number per se) memory usage goes from a couple of megs to 308 megs and the app crashes. So my question is: how to best try to find what's causing this? The object alloc tool in instruments shows the memory as simply going to malloc. (in huge chunks).

    Read the article

  • Virtual Memory and Paging

    - by Kenshin
    Hello, I am doing some exercices to understand how the virtual memory and paging works, my question is as follows : Suppose we use a paged memory with pages of 1024 bytes, the virtual address space is of 8 pages but the physical memory can only contain 4 frames of pages. Replacement policy is LRU. What is the physical address in main memory that corresponds to virtual address 4096? and how do you get to that result? Same thing as question 1 but with virtual address 1024 A page fault occurs when accessing a word in page 0, which page frame will be used to receive the virtual page 0? Page Image

    Read the article

  • renderInContext creating memory that is not promptly released

    - by iworkinprogress
    While debugging in instruments using 'ObjectAlloc' I'm noticing 7megs of memory being allocated for the renderInContext call, but it never is released. When I comment out the renderInContext call this doesn't happen, and future renderInContext calls does not continue to increase the memory allotment. UIGraphicsBeginImageContext(contentHolder.bounds.size); [contentHolder.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); Is there a way to force this memory to be released?

    Read the article

  • Thread Local Memory, Using std::string's internal buffer for c-style Scratch Memory.

    - by Hassan Syed
    I am using Protocol Buffers and OpensSSL to generate, HMACs and then CBC encrypt the two fields to obfuscate the session cookies -- similar Kerberos tokens. Protocol Buffers' API communicates with std::strings and has a buffer caching mechanism; I exploit the caching mechanism, for successive calls in the the same thread, by placing it in thread local memory; additionally the OpenSSL HMAC and EVP CTX's are also placed in the same thread local memory structure ( see this question for some detail on why I use thread local memory and the massive amount of speedup it enables even with a single thread). The generation and deserialization, "my algorithms", of these cookie strings uses intermediary void *s and std::strings and since Protocol Buffers has an internal memory retention mechanism I want these characteristics for "my algorithms". So how do I implement a common scratch memory ? I don't know much about the rdbuf(streambuf - strinbuf ??) of the std::string object. I would presumeably need to grow it to the lowest common size ever encountered during the execution of "my algorithms". Thoughts ? My question I guess would be: " is the internal buffer of a string re-usable, and if so, how ?" Edit: See comments to Vlad's answer please.

    Read the article

  • Memory leak with preg_replace

    - by Silvio Donnini
    I'm using the preg_replace function to replace accents in a string, I'm working with UTF-8. I have incurred in what seems to be a memory leak, but I can't isolate the root cause, my code is rather simple: preg_replace( array_keys($aToNoAccents), array_values($aToNoAccents), $sText ); where $aToNoAccents is an associative array with entries like '~[A]~u' => 'A', '~[C]~u' => 'C',. My script prints this error for the above line: Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 3039 bytes) Obviously it's not a matter of increasing the allowed memory for PHP, (a 1Gb footprint is way off the scale of my application). Also, that line is executed thousands of times without problems but, just for some cases which are difficult to reproduce, it yields the error. Is anyone aware of memory problems with preg_replace and UTF-8 strings? Am I to use special care in passing actual parameters to such function? I'm using PHP 5.2.6-3 with Suhosin-Patch thanks Silvio

    Read the article

  • Loading machinecode from file into memory and executing in C -- mprotect failing

    - by chartreusekitsune
    Hi I'm trying to load raw machine code into memory and run it from within a C program, right now when the program executes it breaks when trying to run mprotect on the memory to make it executable. I'm also not entirely sure that if the memory does get set right it will execute. What I currently have is the following: #include <memory.h> #include <sys/mman.h> #include <stdio.h> int main ( int argc, char **argv ) { FILE *fp; int sz = 0; char *membuf; int output = 0; fp = fopen(argv[1],"rb"); if(fp == NULL) { printf("Failed to open file, aborting!\n"); exit(1); } fseek(fp, 0L, SEEK_END); sz = ftell(fp); fseek(fp, 0L, SEEK_SET); membuf = (char *)malloc(sz*sizeof(char)); if(membuf == NULL) { printf("Failed to allocate memory, aborting!\n"); exit(1); } memset(membuf, 0x90, sz*sizeof(char)); if( mprotect(membuf, sz*sizeof(char), PROT_EXEC | PROT_READ | PROT_WRITE) == -1) { printf("mprotect failed!!! aborting!\n"); exit(1); } if((sz*sizeof(char)) != fread(membuf, sz*sizeof(char), 1, fp)) { printf("Read failed, aborting!\n"); exit(1); } __asm__ ( "call %%eax;" : "=a" (output) : "a" (membuf) ); printf("Output = %x\n", output); return 0; }

    Read the article

  • Macbook memory upgrade question

    - by James Evans
    I've read some conflicting articles on Macbooks and memory upgrades. Some say you have to buy the "special" Mac memory (bulls$%t), others say manufacturers like Partriot and Ocz will work fine. My Macbook (non-pro) is about 6 mos old with it's 2 GB of memory (SO-DIMM 1066MHz DDR3). Does anyone have any definitive information of what will work? Thanks!

    Read the article

  • Unable to remove limit on memory usage for PHP script.

    - by Jess Telford
    The Situation I am having an issue with a PHP script getting the following error message: Fatal error: Out of memory (allocated 359923712) (tried to allocate 72 bytes) in /path/to/piwik/core/DataTable.php on line 969 The script I'm running is: /path/to/piwik/misc/cron/archive.sh I am assuming the numbers are Bytes, which means that total is approximately 360MB. For all intents and purposes, I have increased the memory limits on the server well above 360MB, yet this is the number (give or take a byte) it consistently errors out at. Please note: This question is not about fixing a memory leak in the script, nor about why the script itself is using so much memory. The script is part of the Piwik archiving process, so I cannot just fix any memory leaks, etc. For more info on this script and why I am increasing the memory limit, see "How to setup auto archiving" The question Given that the script is attempting to use over 360MB of memory, which I cannot change, why does it not seem possible for me to increase the amount of memory available to php on my server? What I've tried Increasing PHP's memory_limit Given the php.ini file: php -i | grep php.ini Configuration File (php.ini) Path => /usr/local/lib Loaded Configuration File => /usr/local/lib/php.ini I have edited that file, so the memory_limit directive reads; memory_limit = -1 Restart Apache, and check the new value has stuck; $ php -i | grep memory_limit memory_limit => -1 => -1 Run the script, and get the same error. I've also tried 1G, 768M, etc, all to the same result (ie; no change). Update 22nd June: Based on Vangel's help, I have attempted to set post_max_size to 20M in combination with setting memory_limit. Again, this has no effect. Removing the memory limit on child processes of Apache I have found and edited the httpd.conf file to make sure there is no RLimitMEM directive. I then used WHM's Apache Configuration Memory Usage Restrictions to generate a restriction, which it claimed was at 1000M (and confirmed by checking httpd.conf). Both of these resulted in no change to the script erroring at 360MB. Increasing the per process memory limits of Linux The current limits set on the system: $ ulimit -m 524288 $ ulimit -v 524288 I have attempted to set both of these to unlimited: $ ulimit -m unlimited $ ulimit -v unlimited $ ulimit -m unlimited $ ulimit -v unlimited Once again, this has resulted in absolutely no improvement in my problem. My setup $ cat /etc/redhat-release CentOS release 5.5 (Final) $ uname -a Linux example.com 2.6.18-164.15.1.el5 #1 SMP Wed Mar 17 11:30:06 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux $ php -i | grep "PHP Version" PHP Version => 5.2.9 $ httpd -V Server version: Apache/2.0.63 Server built: Feb 2 2011 01:25:12 Cpanel::Easy::Apache v3.2.0 rev5291 Server's Module Magic Number: 20020903:13 Server loaded: APR 0.9.17, APR-UTIL 0.9.15 Compiled using: APR 0.9.17, APR-UTIL 0.9.15 Architecture: 64-bit Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/usr/local/apache" -D SUEXEC_BIN="/usr/local/apache/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" Output of $ php -i: http://pastebin.com/EiRut6Nm

    Read the article

  • [C#] Not enough memory or not enough handles?

    - by Nayan
    I am working on a large scale project where a custom (pretty good and robust) framework has been provided and we have to use that for showing up forms and views. There is abstract class StrategyEditor (derived from some class in framework) which is instantiated whenever a new StrategyForm is opened. StrategyForm (a customized window frame) contains StrategyEditor. StrategyEditor contains StrategyTab. StrategyTab contains StrategyCanvas. This is a small portion of the big classes to clarify that there are many objects that will be created if one StrategyForm object is allocated in memory at run-time. My component owns all these classes mentioned above except StrategyForm whose code is not in my control. Now, at run-time, user opens up many strategy objects (which trigger creation of new StrategyForm object.) After creating approx. 44 strategy objects, we see that the USER OBJECT HANDLES (I'll use UOH from here onwards) created by the application reaches to about 20k+, while in registry the default amount for handles is 10k. Read more about User Objects here. Testing on different machines made it clear that the number of strategy objects opened is different for message to pop-up - on one m/c if it is 44, then it can be 40 on another. When we see the message pop-up, it means that the application is going to respond slowly. It gets worse with few more objects and then creation of window frames and subsequent objects fail. We first thought that it was not-enough-memory issue. But then reading more about new in C# helped in understanding that an exception would be thrown if app ran out of memory. This is not a memory issue then, I feel (task manager also showed 1.5GB+ available memory.) M/C specs Core 2 Duo 2GHz+ 4GB RAM 80GB+ free disk space for page file Virtual Memory set: 4000 - 6000 My questions Q1. Does this look like a memory issue and I am wrong that it is not? Q2. Does this point to exhaustion of free UOHs (as I'm thinking) and which is resulting in failure of creation of window handles? Q3. How can we avoid loading up of an StrategyEditor object (beyond a threshold, keeping an eye on the current usage of UOHs)? (we already know how to fetch number of UOHs in use, so don't go there.) Keep in mind that the call to new StrategyForm() is outside the control of my component. Q4. I am bit confused - what are Handles to user objects exactly? Is MSDN talking about any object that we create or only some specific objects like window handles, cursor handles, icon handles? Q5. What exactly cause to use up a UOH? (almost same as Q4) I would be really thankful to anyone who can give me some knowledgeable answers. Thanks much! :)

    Read the article

  • maintaing a sorted list that is bigger than memory

    - by tcurdt
    I have a list of tuples. [ "Bob": 3, "Alice: 2, "Jane": 1, ] When incrementing the counts "Alice" += 2 the order should be maintained: [ "Alice: 4, "Bob": 3, "Jane": 1, ] When all is in memory there rather simple ways (some more or some less) to efficiently implement this. (using an index, insert-sort etc) The question though is: What's the most promising approach when the list does not fit into memory. Bonus question: What if not even the index fits into memory? How would you approach this?

    Read the article

  • Why Doesn't UIWebView release all of its memory?

    - by Theory
    I have a graphic-intensive iPad app that features a UIWebView. Using the simulator (iOS 4.2.1), I can see Real Mem increase quite a lot as I browse. The more I browse, the more RAM it uses. When I close the UIWebView and release it, some of the memory it used is freed, but not all of it. This is annoying. Okay, so maybe it's because it isn't deallocated right away. Fine. But then I would expect the system to do some cleanup when there's a memory warning. However, if I browse around, then close the UIWebView (and release it), then trigger a memory warning in the simulator, Real Mem does not change! WTF? So why is this? Why isn't UIWebView better at releasing memory back to the system? And why doesn't it appear to respond to memory warnings? Am I missing something?

    Read the article

  • Running out of memory while analyzing a Java Heap Dump

    - by Abel Morelos
    Hi, I have a curious problem, I need to analyze a Java heap dump (from an IBM JRE) which has 1.5GB in size, the problem is that while analyzing the dump (I've tried HeapAnalyzer and the IBM Memory Analyzer 0.5) the tools runs out of memory I can't really analyze the dump. I have 3GB of RAM in my machine, but seems like it's not enough to analyze the 1.5 GB dump, My question is, do you know a specific tool for heap dump analysis (supporting IBM JRE dumps) that I could run with the amount of memory I have? Thanks.

    Read the article

  • Memory leak, again!

    - by Dave
    A couple of weeks ago I was having trouble with memory leaks associated with a ContextMenuStrip. That problem was fixed. See that question here Now I'm having similar issues with ToolStrip controls. As in the previous problem, I'm creating a large number of UserControls and adding them to a FlowLayoutPanel. Each control creates a ToolStrip for itself in its constructor. When a control is removed from the FlowLayoutPanel (the only reference to the control), it seems memory for the ToolStrip is not being released. However when I comment out the code that creates the ToolStrip the memory leak doesn't happen. Is this the same sort of issue as the previous one - I need to set the ToolStrip to null? I don't see how that could be since this time the control is creating the strip itself, and all the button events etc are handled inside it. So shouldn't everything be GC'd when the control is no longer referenced? EDIT: As to the comments, the thing I don't understand is originally I was "making" my own toolstrip out of a panel and some labels. The labels were used as buttons. No memory leaks occurred this way. The only thing I've changed is using a proper ToolStrip with proper buttons in place of the panel, but all the event handlers are wired the same way. So why is it now leaking memory?

    Read the article

  • memory leak in php script

    - by Jasper De Bruijn
    Hi, I have a php script that runs a mysql query, then loops the result, and in that loop also runs several queries: $sqlstr = "SELECT * FROM user_pred WHERE uprType != 2 AND uprTurn=$turn ORDER BY uprUserTeamIdFK"; $utmres = mysql_query($sqlstr) or trigger_error($termerror = __FILE__." - ".__LINE__.": ".mysql_error()); while($utmrow = mysql_fetch_array($utmres, MYSQL_ASSOC)) { // some stuff happens here // echo memory_get_usage() . " - 1241<br/>\n"; $sqlstr = "UPDATE user_roundscores SET ursUpdDate=NOW(),ursScore=$score WHERE ursUserTeamIdFK=$userteamid"; if(!mysql_query($sqlstr)) { $err_crit++; $cLog->WriteLogFile("Failed to UPDATE user_roundscores record for user $userid - teamuserid: $userteamid\n"); echo "Failed to UPDATE user_roundscores record for user $userid - teamuserid: $userteamid<br>\n"; break; } unset($sqlstr); // echo memory_get_usage() . " - 1253<br/>\n"; // some stuff happens here too } The update query never fails. For some reason, between the two calls of memory_get_usage, there is some memory added. Because the big loop runs about 500.000 or more times, in the end it really adds up to alot of memory. Is there anything I'm missing here? could it herhaps be that the memory is not actually added between the two calls, but at another point in the script? Edit: some extra info: Before the loop it's at about 5mb, after the loop about 440mb, and every update query adds about 250 bytes. (the rest of the memory gets added at other places in the loop). The reason I didn't post more of the "other stuff" is because its about 300 lines of code. I posted this part because it looks to be where the most memory is added.

    Read the article

  • Multiple .NET processes memory footprint

    - by mr.b
    I am developing an application suite that consists of several applications which user can run as needed (they can run all at the same time, or only several..). My concern is in physical memory footprint of each process, as shown in task manager. I am aware that Framework does memory management behind the curtains in terms that it devotes parts of memory for certain things that are not directly related to my application. The question. Does .NET Framework has some way of minimizing memory footprint of processes it runs when there are several processes running at the same time? (Noobish guess ahead) Like, if System.dll is already loaded by one process, does framework load it for each process, or it has some way of sharing it between processes? I am in no way striving to write as small (resource-wise) apps as possible (if I were, I probably wouldn't be using .NET Framework in the first place), but if there's something I can do something about over-using resources, I'd like to know about it.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >