The memory-management tag has no wiki summary.
0
votes
0answers
26 views
{Sum+=i++} to Reach N [closed]
All the positive numbers can be expressed as a sum of one, two or more consecutive positive integers. For example 9 can be expressed in three such ways, 2+3+4, 4+5 or 9. Given an integer less than ...
2
votes
1answer
111 views
Backbone.js: Will this code get cleaned up by the garbage collector
I have been working on a Backbone.js application, and I am starting to think I am making a huge mistake.
I never fully understand garbage collecting, and how exactly some closures prevent it. I just ...
1
vote
0answers
26 views
Memory/Threads leaks, developing simple HTTP-server with WinSock2 [closed]
I begin to develop my tool, which works with net at the TCP level, which will present simple functions of web-server.
In testing my program I have got very bad mistakes:
Memory leaks
Creating ...
2
votes
0answers
106 views
Java: Find the smallest integer not in the list - Memory Efficiency
This is a fairly popular interview question that I conceptually understand but have never really attempted to implement. In other similar implementations of this in Java I have seen they typically ...
2
votes
1answer
146 views
For Large number of nodes Min Heap implementation Dijkstra's Algorithm throwing OutOfMemoryError Exception
I am implementing Dijkstra's Algorithm using Min Heap to speed up the code. For small number of nodes, the code is really running very fast. But for large number of nodes, my code is throwing ...
1
vote
1answer
74 views
Variable sized type allocation
I have a type that receives serial data over a pipe:
struct Packet : Base { // Base is POD, too
int foo;
char data[];
};
In the context, where I instantiate Packet, I already know how large ...
1
vote
1answer
119 views
Is this a valid usage of structure assignment in C?
Q: Please comment on the usage of structures and structure assignment operations in C
I am working on converting a MATLAB program to C using BLAS and LAPACK for linear algebra support. The MATLAB ...
2
votes
2answers
109 views
Read until EOF and realloc as needed
This is a function that reads until EOF and reallocs as it goes.
char *
read_to_end(int fd, int *bread)
{
ssize_t size, nread, rc;
char *buf, *tmp;
nread = 0;
size = MINLEN;
buf ...
3
votes
2answers
216 views
Tree Node class - deallocation in the destructor
Is my destructor correct does it properly deallocate the subtrees?
#ifndef HEADER_GUARD__TREE
#define HEADER_GUARD__TREE
#include <deque>
namespace Sandbox {
class Node {
public:
...
4
votes
1answer
146 views
Simple TCP client - memory issues
Does this snippet take too much memory? How can I let the connection opened with the function connectTo outside the forever loop?
import Control.Concurrent
import Network
import System.IO
import ...
1
vote
1answer
104 views
Am I using my data source array correctly?
When I want to make some quick tests for my UITableViewControllers, I usually create an NSArray that holds some dummy data. I would like to know if I'm doing anything wrong here:
First in ...
3
votes
1answer
231 views
Space to allocate before sprintf
I just finished chasing a Heisenbug that was entirely my fault. I'd like to avoid it happening again.
I have a function which formats a date to a certain preset format. Turns out I was not allocating ...
3
votes
2answers
163 views
Human (Imperfect) array (card) shuffle written in C
ok, so I've got this humanoid_shuffle I wrote in python... And I've been wanting to learn C so as an exercise I ported it to C, as this is my first venture into C and even the idea's of memory ...
4
votes
1answer
295 views
Memory issues with Find Strings Problem on InterviewStreet
Here is the code I wrote for the problem at http://www.interviewstreet.com/recruit/challenges/solve/view/4e1491425cf10/4efa210eb70ac where we need to to print the substring at a particular index from ...
4
votes
1answer
97 views
Is this a good algorithm for 2D collision, or will it allocate too much memory?
I have a Rectangle class, of which I have 5-6 vectors for each instance. The main vectors are the center and color of the object, while the secondary vectors represent more or less the north, south, ...