allocation

Dynamically Allocate Cache Size to Alleviate HeapSpace Error

We have a collection of objects which grows quite large over time. We have implemented a caching strategy to help alleviate this, however we are still running out of Heap Space at run time - if enough memory isn't allocated at startup. Is there a standard mechanism to reduce the size of this cache at runtime to remove these OutOFMemory...

pinned memory opencl, has anybody successfully used it?

I used the CL_MEM_ALLOC_HOST_PTR flag with my clCreateBuffer calls, but the Compute Profiler shows all my "host mem transfer type" as being Pageable. I tried it in two different kernel setups, but the profiler wouldn't show that I was using pinned memory. Is it just really random when a kernel gets to use pinned memory? Is it constraine...

Code requires too much memory

Hello, I'm porting some code to another structure: class EnvironObject { protected: vector<float> mX, mY, mXSpeed, mYSpeed; int mMaxObjects; public: virtual void init(int maxObjects); virtual void setLimit(int limit); virtual int getLimit(); virtual void update(float arg) = 0; }; void EnvironO...

Allocate Virtual memory before running out of RAM

is it possible, in a C/C++ program, to allocate virtual memory (Swap Space) for an specific array, so that the program keeps using RAM for the rest of variables, and maybe getting some benefit at some type of problems?? ...

Stack-based object instantiation in D

I'm learning D, and am confused by an error I'm getting. Consider the following: module helloworld; import std.stdio; import std.perf; ptrdiff_t main( string[] args ) { auto t = new PerformanceCounter; //From managed heap //PerformanceCounter t; //On the stack t.start(); writeln( "Hello, ", size_t....

Dynamic Contiguous 3D arrays in C

I'm trying to implement dynamically allocated contiguous 3D arrays in a C code. The arrays must be contiguous because I'm relying on netCDF output of the arrays. Now I adapted a solution posted here Stack OverFlow Solution. This works fine for dynamically allocating the arrays and indexing them...however, when netCDF outputs them ther...

Allocating memory to pointer structures inside structures

If I have a structure such as typedef struct _people { char *name; bool *exists; struct _people **citizens; } PEOPLE; How do I go about allocating memory so that people->citizens[0]->name is accessible? I've tried info->citizens = malloc(sizeof(PEOPLE *)*numbPeople); However when I try to access info->citizens->name I get th...

Retaining C memory throughout the function

Assuming I have a piece of code similar to this: SOMESTRUCTURE *info; info = malloc(sizeof(SOMESTRUCTURE)); while(something...) { info->mini[0] = malloc(sizeof(SOMESTRUCTURE *)); // It's a structure inside the same structure while(something...) { info->mini[x]->name = malloc(sizeof(char *)*strlen(name)); ...

C Memory Overflow (v2)

EDIT: Updated code with new Pastebin link but it's still stopping at the info->citizens[x]->name while loop. Added realloc to loops and tidied up the code. Any more comments would be greatly appreciated I'm having a few problems with memory allocation overflowing http://pastebin.com/vukRGkq9 (v2) No matter what I try, simply not enoug...

Open jar from another jar

Hello , The same old problem ... I want to run my jar on Mac or Linux with high memory allocation. I do not want the user to open the Terminal and write java -XMx512 -jar MainJar.jar manually. I have seen a lot of solutions to fix this ... But i was wondering if this might work : "Executing the Terminal command java -XMx512 -jar MainJ...

[C] Matrix: Memory allocation question

Hello! I'm doing a program that reads from a text file in order to determine the size of the matrix (rows and cols) and respective content of the matrix. I was wondering if something like: int main() { int rows = FunctionThatReadsRows(); int cols = FunctionThatReadsCols(); int matrx[rows][cols]; return 0; } Would work? Or does it nee...

Manipulating pointers using C

Hi, While working with pointers in C, I have been experiencing a very incosistent result, I am working with a token which is a byte string which i need to make a directory path. a token consists of the date as a prefix in the format of 20101129(2010-oct-29) and then a 20byte string follows, thus a token would look like 20101102A2D8B328CX...