memory

Should I typecast in PHP when defining my vars?

I am sorry if this is more of a theory question then a real life problem but it is a real life situation for me. We were commenting on the way PHP works with vars and how memory heavy it is on the server due to its "mixed vars" and something occured to me - why not typecast right from the start? So I guess my quesion is: Whould it make ...

Memory management in Qt?

I'm quite new to Qt and am wondering on some basic stuff with memory management and the life of objects. When do I need to delete / destroy my objects? Is any of this handled automatically? In the example below, which of the objects I create do I need to delete? What happens to the instance variable myOtherClass when myClass is destroy...

C++ Reserve Memory Space

is there any way to reserve memory space to be used later by default Windows Memory Manager so that my application won't run out of memory if my program don't use space more than I have reserved at start of my program? ...

How to assign void* pointer1 to void* pointer2? Facing some problem

void* ptr1 = NULL; void* ptr2 = ptr1; unsigned int *buf = data;//some buffer //now ptr2 = buf + 8; The above change in address of ptr2 is not reflected in ptr1. I am trying void* ptr2 = &ptr1; too. Please let me know whats the mistake here. ...

How would I deep copy a vector in J2ME / BlackBerry?

How would I deep copy a vector in J2ME / BlackBerry? ...

What does flushing thread local memory to global memory mean?

Hi, I am aware that the purpose of volatile variables in Java is that writes to such variables are immediately visible to other threads. I am also aware that one of the effects of a synchronized block is to flush thread-local memory to global memory. I have never fully understood the references to 'thread-local' memory in this context....

Can SHA-1 algorithm be computed on a stream? With low memory footprint?

I am looking for a way to compute SHA-1 checksums of very large files without having to fully load them into memory at once. I don't know the details of the SHA-1 implementation and therefore would like to know if it is even possible to do that. If you know the SAX XML parser, then what I look for would be something similar: Computin...

MPM Prefork Apache Uses Absurd Amount of Memory

Help! My apache processes are all using 115MB of memory on startup. Relevant information: Linux version (uname -a) Linux 2.6.31-14-generic-pae #48-Ubuntu SMP Fri Oct 16 15:22:42 UTC 2009 i686 GNU/Linux Apache version (/usr/sbin/apache2 -v) Server version: Apache/2.2.8 (Ubuntu) Server built: Mar 9 2010 20:45:36 Top display (top...

memory not freed in matlab?

I am running a script that animates a plot (simulation of a water flow). After a while, I kill the loop by doing ctrl-c. After doing this several times I get the error: ??? Error: Out of memory. And after I start receiving that error, every call to my script will generate it. Now, it happens before anything inside the function that I...

Why does my C++ LinkedList method print out the last word more than once?

When I call the cmremoveNode method in my LinkedList from outside code, I get an EXC_BAD_ACCESS. FIXED: But now the last word using the following test code gets repeated twice: #include <iostream> #include "LinkedList.h" using namespace std; int main (int argc, char * const argv[]) { ctlinkList linkMe; linkMe.cminsertNode("The");...

An interesting case of delete and destructor (C++)

I have a piece of code where I can call destructor multiple times and access member functions even the destructor was called with member variables' values preserved. I was still able to access member functions after I called delete but the member variables were nullified (all to 0). And I can't double delete. Please kindly explain this. ...

Reading and writing to/from memory in Python

Let's imagine a situation: I have two Python programs. The first one will write some data (str) to computer memory, and then exit. I will then start the second program which will read the in-memory data saved by the first program. Is this possible? ...

Impact of Multiple .ToUpper()'ing

This is not a question of premature optimization per se. On the garbage collector and memory in general, what would hundreds of ToUpper() operations (many could be duplicated) do to a program, mainly in regard to the immutability of strings? ...

Java BigDecimal memory usage?

Is there a guideline for estimating the amount of memory consumed by a BigDecimal? Looking for something similar to these guidelines for estimating String memory usage. ...

DataSet size best practices - are there any general rules?

I'm working on a desktop application that will produce several in-memory datasets as an intermediary before being committed to a database. Obviously I'm going to try to keep the size of these to a minimum, but are there any guidelines on thresholds I shouldn't cross for good functionality on an 'average' machine? Thanks for any help. ...

Exactly How Does My C++ Program Terminate When it Runs Out of Memory?

The following C++ program crashes on my Windows XP machine with a message "Abnormal program termination" class Thing {}; int main() { for (;;) new Thing(); } I would say it's an out of memory problem, except I'm not sure Windows gets near the limit. Is it Windows killing it on purpose? If so, how does it decide? ...

How to show percentage of 'memory used' in a win32 process?

I know that memory usage is a very complex issue on Windows. I am trying to write a UI control for a large application that shows a 'percentage of memory used' number, in order to give the user an indication that it may be time to clear up some memory, or more likely restart the application. One implementation used ullAvailVirtual fr...

How can I find out how much memory is physically installed in Windows?

I need to log information about how much RAM the user has. My first approach was to use GlobalMemoryStatusEx but that only gives me how much memory is available to windows, not how much is installed. I found this function GetPhysicallyInstalledSystemMemory but its only Vista and later. I need this to work on XP. Is there a fairly simple ...

Freeing Java memory at a specific point in time

Given this code, where we load a lot of data, write it to a file, and then run an exe.. void myMethod() { Map stuff = createMap(); //Consumes 250 MB memory File file = createFileInput(stuff); //Create input for exe runExectuable(file); //Run Windows exe } What is the best way to release the memory consumed by stuff prior...

is memory allocated in JNA (or JNI) by the C code limited by jvm (param -Xmx or architecture 32/64)

that is, could a malloc() asking for 5 mb in the C part fail due to: jvm was run with -Xmx32m and jvm heap is already 30 mb something to do with jvm being 32 bits in a 64 bits windows ...