Memory refers to the physical devices used to store programs or data on a temporary or permanent basis for use in a computer or other digital electronic device.

learn more… | top users | synonyms

-3
votes
0answers
87 views

High performance Inter Process Communication (IPC)?

Apologies if this question is "off-topic", I hope it's not... I'm looking for an IPC technology that is capable of communicating to processes on other machines, as well as on the same machine, with ...
2
votes
2answers
180 views

Why do convolutional neural networks use so much memory?

I heard that one of the main problems applying neural style to high resolution images is the huge amount of memory that would use. Also I just configured a network using tiny-cnn This is my ...
3
votes
0answers
51 views

How to debug leak in native memory on JVM? [migrated]

We have a java application running on Mule. We have the XMX value configured for 6144M, but are routinely seeing the overall memory usage climb and climb. It was getting close to 20 GB the other day ...
1
vote
1answer
52 views

Need info on malloc trace

When I try the below code I am not clearly able to analyze malloc api internal calls.What I am not clear is about the system call mmap is called only once for 2 or more malloc calls.If I am assigning ...
0
votes
3answers
71 views

Value addresses of functions

I'm reading Yung-Hsiang Lu's book, Intermediate C Programming, and I'm working through the chapter on stack memory. When defining the value address he provides this code example: int f1(int k, int m) ...
1
vote
1answer
108 views

Static memory idiom

I am on a micro controller (which means I can only have static memory allocation) and I am trying to work with inheritance..... Suppose I have a abstract class Image and an abstract class Font. An ...
1
vote
2answers
141 views

Should I be using IDisposable here, to properly manage memory?

Background I have an object that represents a test procedure that I need to run on a product. This object may be used multiple times during run-time, depending on how many times the user elects to ...
2
votes
1answer
215 views

When to malloc and free?

Valgrind does not report a memory leak during my actual usage, only during my scripted test that I scripted with a shell script to test my own shell. I found that I didn't have to use malloc every ...
80
votes
6answers
13k views

Why are floats still part of the Java language when doubles are mostly recommended instead?

In every place I've looked, it says that double is superior to float in almost every way. float has been made obsolete by double in Java, so why is it still used? I program a lot with Libgdx, and ...
2
votes
1answer
99 views

When should I worry about freeing objects from memory in Python?

I've been reading a few different guides and tutorials, as I am interested in learning some best practices of programming. I was reading the How to be a Programmer guide, and there is a section about ...
3
votes
0answers
111 views

Laissez faire memory management [duplicate]

I noticed that various scripting language interpreters leak memory even for very simple programs, like the canonical "Hello world!" program. To illustrate the problem with examples: Perl 5.22 leaks ...
25
votes
8answers
4k views

Is it possible to statically predict when to deallocate memory---from source code only?

Memory (and resource locks) are returned to the OS at deterministic points during a program's execution. The control flow of a program by itself is enough to know where, for sure, a given resource can ...
0
votes
2answers
90 views

Does storing a value in a variable uses more RAM than using it directly?

I mean, does something, for example in C#, like String test = "Test"; txtCtrl.Text = test; consumes more RAM than just txtCtrl.Text = "Test"; ? As it's said, a variable is a reserved space in ...
1
vote
2answers
98 views

Load to list in one loop and then process list in another or do it all at once

I have a dataset full of rows that I must initialize into myclass and then process. I am currently looping through each row in the dataset, initializing a new instance of myclass, then adding that ...
8
votes
1answer
1k views

Redux memory consumption [closed]

The Redux framework favors immutable state/pure function paradigm, which promotes creation of new state from the previous state in terms of the current action. The applicability of this paradigm is ...
2
votes
2answers
120 views

Code size overhead by including unnecessarily extra header files

I have a program which includes lots of header files but it do not uses all the header files. I have removed some of them although it is working fine. I did not notice any changes in the performance. ...
51
votes
5answers
10k views

Can the “level 256 bug” in the game of Pacman be considered an unhandled segfault?

I am trying to explain segmentation faults to someone, and I was thinking about the level 256 kill-screen in Pacman, and how it's triggered by integer overflow, and how similar the behavior is to the "...
29
votes
5answers
5k views

If a number is too big does it spill over to the next memory location?

I've been reviewing C programming and there are just a couple things bothering me. Let's take this code for example: int myArray[5] = {1, 2, 2147483648, 4, 5}; int* ptr = myArray; int i; for(i=0; i&...
2
votes
2answers
205 views

Where is the class itself stored at runtime to be used as a reference

In C# or Java we find that the objects are stored on heap and their reference vars are stored on stack. But at run time where is the class definition stored to be used as a template for creating ...
2
votes
4answers
192 views

In a byte, each additional bit doubles the representable states, but does it double memory?

A friend asked me whether adding a single bit more memory doubles the amount of memory you have, as the bit doubles the amount of representable states. My brain got stuck thinking about it. Doubling ...
2
votes
2answers
278 views

Java Game. Preload objects and reuse vs create objects at runtime [closed]

I'm currently developing my first game in Java language. The game is an endless runner with obstacles to avoid and enemies to kill. Unfortunatelly im still not experience enough and many times im ...
6
votes
2answers
165 views

Does Time Complexity analysis factor for cache performance of an algorithm?

If I have an algorithm A. and it has fewer instructions than algorithm B. but performs worse on a CPU due to poor memory coalescing (and hence, poor CPU cache performance), does that factor into the ...
2
votes
1answer
205 views

Why is checking weird bit errors important in garbage collectors?

Here's a rough translation of a tweet by @xharaken. "Space rays hit computers and mess up the bits in the memory" "hardware bugs mess up the bits in the memory" such things almost never happen, ...
4
votes
3answers
199 views

In x86, where are the memory addresses of the values on the stack located?

Suppose I have a very simple C program that just does this: int i = 6; int j = 4; int k = 5; int a = i + j + k; Since i, j, and k are on the stack, they will be located relative to the stack ...
1
vote
3answers
98 views

Reading from Memory vs Performing an Operation [closed]

I'm learning to program microcontrollers and am trying to develop good habits: Suppose I have a set of values which can be calculated based on what is already in memory. As a general rule, is it ...
2
votes
1answer
280 views

Memory/cache performance in working with arrays in C

I've been toying with some array examples in C. I want to understand more about memory concepts, alignment, and cache. Especially on large arrays on heap. Sometimes I work on large images (extremely ...
-3
votes
1answer
78 views

dma allocation in kernel 4g patch theory [closed]

I was reading about that that old patch. The summary of that link is to create a 4Gb kernel space, instead of 1Gb by default. Since many dma capable devices can only access 32 bit addresses or 4Gb, ...
2
votes
2answers
67 views

Efficiently editing text files [duplicate]

I have been working with some fairly large text files containing about two million lines of text. I don't know the length of the content or the lines in advance, just the number of lines. I have been ...
2
votes
1answer
171 views

In garbage collecting languages (JavaScript), can I securely overwrite data?

Realizing that garbage collection and memory management is implemented differently in different environments for sake of simplicity this question will focus on JavaScript (either V8 or Seamonkey). I ...
7
votes
3answers
1k views

Foreach loop and variable initialization

Is there a difference between these two versions of code? foreach (var thing in things) { int i = thing.number; // code using 'i' // pay no attention to the uselessness of 'i' } int i;...
20
votes
3answers
2k views

Why are C string literals read-only?

What advantage(s) of string literals being read-only justify(-ies/-ied) the: Yet another way to shoot yourself in the foot char *foo = "bar"; foo[0] = 'd'; /* SEGFAULT */ Inability to elegantly ...
1
vote
3answers
148 views

Pre-calculate values or not on Raspberry Pi

Say that you want to rotate something 360 steps 100 times. You now have a choise to pre-calculate 360 sin and cos values once and then use the stored values 100 times, or you can calculate sin and cos ...
12
votes
2answers
491 views

What uses does Smalltalk’s ‘become:’ have?

The become: message in Smalltalk causes one object to change into another, affecting all references to it. What uses does this language feature have? Does it get used in real code? Is it just a ...
1
vote
2answers
398 views

What is a latency-bound and a memory-bound application in HPC?

I understand that in HPC hybrid systems, for instance a MIC architecture, main memory access is much slower than access to data in own cache or in the cache of another core. I read that HPC MIC ...
0
votes
2answers
78 views

Memory page - virtual or physical and relation to data types allocation?

I'm looking for a understandable definition of memory pages. Please help me clarify the following questions: Is a "memory page" always related only to a data chunk of virtual memory? Are physical ...
1
vote
1answer
387 views

Android & OutOfMemoryError: Possible causes besides memory leak?

In my application I keep receiving crash reports where the root cause is an OutOfMemoryError. The app is quite image heavy (I use Picasso for all the image loading) and also has a WebView component ...
5
votes
2answers
316 views

Does sun.misc.Unsafe give access to the system or just the JVM?

Please note: Although this question involves microcontrollers, it is at its core, a Java question, and so I believe it can be answered by any battle-weary Java guru. I stumbled accross this blog ...
0
votes
2answers
107 views

Should I set values using the return or by giving a reference?

Suppose I have a mouse position watcher, which should let the user extract the mouse position. Should the mouse position be set in the method and returned: Mouse_Position Mouse_Watcher::...
1
vote
1answer
151 views

Memory Limit of a Single Program and mmap

If one has a 32 bit machine, a single program cannot address more than 2^32 bytes, or 4 GB. Would making use of mmap() allow one to exceed the 4 GB limit?
3
votes
1answer
635 views

Are there real world examples demonstrating reasonable performance improvement by using move semantics?

(I've asked a similar question on SO but unfortunately it might not be proper, so I also put here; please kindly point out if you think it's a duplicate.) I've heard many words about the move ...
1
vote
5answers
8k views

How to share memory between applications written in C/C++

I'm going through a program written in C/C++ for control in robotics. Basically, three different programs run at the same time, and they communicate via shared memory. Google-ling around I found ...
2
votes
1answer
299 views

How can C++ make it possible to use dynamic container classes even in embedded systems?

How can C++ make it possible to use dynamic container classes even in embedded systems? Background info: I've been working with PIC (C) and AVR (C++) processors and at the moment (PIC C) I'm ...
1
vote
1answer
155 views

Translation Lookaside buffer - Lookup By Page Size

I am having a hard time finding documentation that explains precisely how the various TLB caches are used in modern processors. Most modern processors have separate TLBs for code/data. That in itself ...
118
votes
9answers
16k views

When is it a good idea to force garbage collection?

So I was reading a question about forcing the C# garbage collector to run where almost every single answer is the same: you can do it, but you shouldn't - except for some very rare cases. Sadly, ...
0
votes
0answers
35 views

Cache Memory Vs Main Memory [duplicate]

Why is the access time of the cache memory lesser than the access time of the main memory? I have tried looking at the sites as - tutorialspoint.com, education-portal.com etc. I know that the ...
3
votes
2answers
249 views

Place variables frequently used by the same function on the heap?

Say that I have the following situation: void myFunc() { int x; //Do something with x } "x" is placed on the stack which is no doubt fast. Now, "myFunc" is called very frequently, lets say ...
4
votes
2answers
1k views

Best practice for uploading large file, previewing, and editing before saving to database?

I am allowing users to upload a relatively large .csv file (about 1MB) - it will contain thousands of records that each represent one of my business objects. I want the users to upload the file and ...
0
votes
1answer
152 views

Architecture question about data migration

I'm facing a new enterprise project in Java about data migration. I did one of them in the past, now I want to do a better work and I think I need your considerations. So, let's me explain the ...
2
votes
1answer
1k views

Relation between cache line and memory page

If I am correct, a page in a main memory is the smallest unit unit for transfer data between the main memory and an external storage device, such as a hard disk. A cache line of a main memory is the ...
0
votes
1answer
2k views

Facing MemoryError in Python

I wrote a program to find prime factors of a number. When I give a large number(600851475143) as input, MemoryError pops up. Below is the code: def fact(a): factors = [] for i in range(1,a+1)...