memory-management,jvm,ehcache , Does ehcache reserve (allocate) heap memory set with maxBytesLocalHeap?

Does ehcache reserve (allocate) heap memory set with maxBytesLocalHeap?


Tag: memory-management,jvm,ehcache

I use ehache 2.8.

I am not sure I understand the documentation correctly regarding reservation of the memory for the cache.

Is the memory set in ehcache.xml like this:

<ehcache maxBytesLocalHeap="256M">



..actually being allocated at start and this cache will use exactly 256MB of heap or does this only mean (like it should, if this attribute is named like it is) that this cache can take at most 256MB of heap?


This means that this cache will do its best to contain 256MB or less of user data. The actual memory footprint of the cache can be larger due to internal data structures.

Also in case the cache operates at full capacity, it may go over size while eviction takes place.


Is there a better way to do this than writing a wrapper allocator that stores a reference to a stateful allocator object?

For example: struct Foo { MyPoolAlloc<char> pool; std::vector<int , MyPoolAlloc<char>> vec_int; // The wrapper allocator would replace MyPoolAlloc<> here. std::vector<std::function<void()> , MyPoolAlloc<char>> vec_funcs; // The wrapper allocator would replace MyPoolAlloc<> here. Foo() : vec_int(pool) , vec_funcs(pool) {} // I want to store lambdas with captured variables using the custom allocator...

Does Java JVM use pthread?

Does JVM on Mac OS X use pthread to create threads? What about on Linux distributions, is it now default way to create threads for JVM on all distributions?...

Exposing whether an application is undergoing GC via UDP

The motivation behind this question is to see whether we can make a theoretical load balancer more efficient for edge-cases by first applying its regular strategy of nominating a particular node to route an HTTP request to (say, via a round robin strategy) and then "peeking" into the internal state...

Intellij IDEA long processing for grails app with warning “too much output to process”

I new to Intellij for Grails app while run the app it execute lot of thing with the warning "Too much output to process" & takes comparatively more time to start the server. Below is the log screen ( at at$1.getObject( at...

Does jni::ExceptionDescribe implicitily clear the exception trace of the JNI environment object?

I tried to implement some kind of exception handling At first i called jni::ExceptionDescribe() after that i used the implementation of How to obtain a description of a Java exception in C++ when using JNI? which i just named for simplicity printStackTrace()and which completely works fine . My problem is...

What is a “non-weak zeroing reference”

In the OS X v10.11 beta release notes, I find the following: NSNotificationCenter and NSDistributedNotificationCenter no longer send notifications to registered observers that may be deallocated. If the observer is able to be stored as a zeroing-weak reference the underlying storage stores the observer as a zeroing weak reference. Alternatively,...

Allocating memory for pointers inside structures in functions

Let's say I declare a structure as it follows: typedef struct { int *numbers; int size; // Size of numbers once treated as array } sstruct; And I create in main() a pointer to structure (in order to later pass it by reference) using sstruct *example;. Then I have a...

Java how to limit number of threads acting on method

I have java method in my web application doing heavy file operation. The thing is, if more than 5 threads come simultaneously (which will come in testing phase) it breaks down. I mean it cannot handle heavy traffic. That's why I want to handle maximum 5 requests at a time...

Explanation of why allocating a large array results in segmentation fault in C [duplicate]

This question already has an answer here: Segmentation fault on large array sizes 5 answers Memory allocation for global and local variables 3 answers I'm not too experienced in C, but I've been recently writing some program in the language to speed it up a little bit (it was...

Unable to increase PHP Memory Limit

I am running into an issue with a project I am working with on my localhost, where I am unable to increase the PHP memory_limit setting. I've tried increasing it directly in the php.ini config: memory_limit = 1024M I've tried increasing it in the projects .htaccess file: php_value memory_limit 1024M...

Why should I dimension my variables in VBA really?

They used to say it was about memory management. However, having a look at things I find that failure to dimension a variable will default it to a variant data type which allocates 22 bytes of memory. Let's consider just a single megabyte of memory. 1,000,000 bytes. This means I...

Retain cycle in Swift when Object A has Object B as a property and Object B has an array property that contains Object A?

Confused about a situation that might be a retain cycle? I understand that if class Object-A { var b: Object-B } and class Object-B { var a: Object-A ] then above is horrible design because if you do var a = Object-A() var b = Object-B() a.b = b b.a...

Temporary variable destroyed with overloaded + and += operator

I am getting a segfault because I believe my temporary variable is being destroyed (freeing allocated memory) before the operators are done using it. This is the code in my main: int main(int argc, char *argv[]) { Bcd b1 = Bcd(100), b2 = Bcd(20), b3 = Bcd(50); b3 += b1...

Fortran memory allocation does not give an error, but the program is killed by OS at initialization

Given the minimal working example provided below, do you know why the memory allocation error does not occur at memory allocation step? As I checked, when I use valgrind to run the code, or add parameter source=0.0 to memory allocation statement, then I have, as expected, the memory allocation error....

How can I ensure an emxArray is correctly allocated in generated C code?

I have the following .m file (named testmemoryallocation.m), targeted for code generation in Matlab Coder. This is just a test file demonstrating the concept, of course. function output = testmemoryallocation(dim) %#codegen %TESTMEMORYALLOCATION Tests allocation of large 3D arrays output = coder.nullcopy(zeros([dim, dim, dim])); output(:) = 5; end I build this...

Why I cannot use “fgets” to read a string to an element of my Struct?

I'm trying to create a program almost like "bank" using struct, but when the program should have read the string (variable "nome" that is name in portuguese) it totally ignore the "fgets" that I used. This is the part that I was talking about : printf("\nNome: \n"); fgets(vet[cont+1].nome, sizeof(vet[cont+1].nome), stdin);...

Memory error in set resize

Here's a structure of set that I've written: struct state_set { struct state ***state_array; size_t *slot_sizes; size_t *slot_memory; }; Here's an initializer: struct state_set *state_set_init() { struct state_set *new_set = malloc(sizeof(struct state_set)); new_set->state_array = malloc(ARRAY_SIZE * sizeof(struct state**)); new_set->slot_sizes = malloc(ARRAY_SIZE * sizeof(size_t)); new_set->slot_memory = malloc(ARRAY_SIZE * sizeof(size_t)); for (int...

C# apps using ram and cannot be cleared

Okay, i had create an apps and the apps are eating ram too much. The Problem: At the clearing process, i dispose the object but the ram usage isn't going down I don't have any idea, where is the mistake. How the program works Started user press space -> screen...

Simple explanation about loading files into memory,visual-studio-2010,memory-management
What does it mean to "load into memory"? I watched some videos online where they were talking about reducing processing reports times, and they constantly say "you don't want to load a huge file into memory, instead read line by line." Can I have an example of what loading a...

Using a data pointer with CUDA (and integrated memory)

I am using a board with integrated gpu and cpu memory. I am also using an external matrix library (Blitz++). I would like to be able to grab the pointer to my data from the matrix object and pass it into a cuda kernel. After doing some digging, it sounds...

Disadvantages of calling realloc in a loop

I'm trying to implement some math algorithms in C on Windows 7, and I need to repeatedly increase size of my array. Sometimes it fails because realloc can't allocate memory. But if I allocate a lot of memory at once in the beginning it works fine. Is it a problem...

Can't open eclipse with Windows 7 (doesn't see jdk jde)

I'm trying to open eclipse for the first time, but otherwise I have this same problem as [Eclipse cannot find javaw.exe. The bit depth isn't resolving the issue. I have JDE & JDK 8 update 45 installed, and I've downloaded latest 64-bit version of Eclipse. The information given on command...

Deleting a dynamically allocated 2D array [duplicate]

This question already has an answer here: delete vs delete[] [duplicate] 4 answers So I'm used to memory management in C where free(pointer) will free up all space pointed to by pointer. Now I'm confusing myself when attempting to do something simple in C++. If I have a 2D...

c++ dynamically declared array fails to work

I am trying to read the file's data into a dynamically declared array, using double *data = new double[14141414]() declaration. Note, it is rather a large file; hence large size of an array. The problem is I can not put all the data into an array as somewhere around index=14000000...

Cannot free fileName char * after fclose

I am trying to free my file name (char * pointer) but got an error : Heap corruption detected: after normal block (#65) at 0x.... The code: static FILE *initializeIndexFile(char *database, char **indexFileName) { FILE *file1_p; *indexFileName = NULL; int len = strlen(database); *indexFileName = (char *)malloc(len *sizeof(char) + 1);...

Fast memory allocation for real time data acquisition

I have a range of sensors connected to a PC that measure various physical parameters, like force, rotational speed and temperature. These sensors continuously produce samples at some sample rate. A sample consists of a timestamp and the measured dimension itself; the sample rates are in magnitudes of single-digit kilohertz...

Operator Overloading without memory copies

Imagine we have the type A and we want to do the following operation: A operator -(const A& a, const A& b) { A c; //... return c; } When we call this operator, we do something like this: A c; c = a - b; Basically we are allocating...

JVM ClassUnloadingWithConcurrentMark flag

I have a question about ClassUnloadingWithConcurrentMark flag since I didn't find any useful help anywhere. If we use G1GC is set to true by default (-XX:+ClassUnloadingWithConcurrentMark). If I use -XX:-ClassUnloadingWithConcurrentMark flag to turn off class unloading after G1 concurrent mark where is class unloading executed then (which phase)? I read...

Linkage Error in Tomcat when 2 webapp instances load lucene classes

I'm running a tomcat 8 container with 2 different webapps, 1 prod and 1 sandbox. All the classes/libs and compilation is the same with just some minor differences in the config parameters. I'm using lucene core 4.10.4 (via hibernate search). Both apps startup just fine, now after startup if I...

QEvent ownership

I want to send both predefined and custom QEvent to a Qt application. Is the event required be allocated on the heap or can I just pass the pointer to a object on the stack? QKeyEvent stackevent(QEvent::KeyPress); QKeyEvent* heapevent = new QKeyEvent(QEvent::KeyPress); QEvent * event; event = &stackevent; //valid ??...

Getting many memory errors when try to run it for few days in my web crawler [on hold]

I am developing a web crawler application. When i run the program i am getting these error messages below: i've got these errors after running the program for more that 3 hours. I tried to allocate memory by changing eclipse.ini setting to 2048 MB of ram as it was answered...

function to get 2d-arrays from stack and heap

Consider a simple struct, Foo, which contains a pointer to some other strucrt, Baz. and a two-dimensional array, (stack-allocated): Foo arr[ARR_SIZE][ARR_SIZE]; Next, consider a function which mallocs (in the heap, obviously) a memory for a new 2d-array of Foos. A code snippet: Foo** arr_copy = malloc(sizeof(Foo*) * ARR_SIZE); for (int...

Effect of setting -XX:+PerfDisableSharedMem JVM flag to false

I was referred to this GC pause issue; it suggests setting -XX:+PerfDisableSharedMem JVM flag to false. My question is what happens when we set this flag to false,

Sharing std::string across shared memory

I wish to share a std::string across processes using shared memory. However, I'm concerned about where the string object is allocated, on the stack, or heap, as this will affect the share. Referring to this, MSDN Forum says : please note that in new STL (Visual Studio 2003 and...

How does a servlet handle more bytes than available RAM?

Lets say that I have a servlet running that accepts files of any size from a client application(s). The file being sent is loaded into a DataHandler and is transmitted by web-services; as such is received and put back into a DataHandler. What happens if the file being sent exceeds...

Does jar differentiate between program arguments and jvm arguments

I am trying to execute a jar file. It needs both program arguments and the jvm arguments. Do we need to do something different while passing the command line parameters in order for it to be able to differentiate them, or it will be handled automatically? Currently I am using...

uninitialized data segment of program memory

In Uninitialized Data Segment, the kernel initialize the uninitialized variable to 0. But if we directly use an uninitialized variable (for eg. int sum; and not int sum=0; ) and use it in program like sum=sum+n(n be any number), sum will take any garbage value. So why the sum will...

Most efficient way to clone a list into an existing list, minimizing memory reallocation?

I have a need to clone an existing list into another, existing list. As the environment demands very high performance, I need to eliminate unnecessary memory reallocation. The most efficient algorithm I can think of is the following, which will increase the capacity of the destination list to match the...

Using and having allocation memory issue

I'm new to programming, I've been making an app for the last 3 months and learned a few things. But I haven't come across to how to solve this issue. I've been using as my server, sending pictures, saving user data etc. With all of this data the app...

Why is Java faster if it repeats the same code?

Given the following code: public class Test{ static int[] big = new int [10000]; public static void main(String[] args){ long time; for (int i = 0; i < 16; i++){ time = System.nanoTime(); getTimes(); System.out.println(System.nanoTime() - time); } } public static void getTimes(){ int d; for (int i = 0;...

Java 8 , JCE Unlimited Strength Policy and SSL Handshake over TLS

With Java 8, server which only supports TLSv1, it fails to make secure socket connection from cent OS Version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) Source import; import; import; import; import; import;...

JVM is functioning very differently with same flags

I created test application (with Sheduler inside that runs every 20ms, there are reads/writes to DB) and deployed it on Glassfish server on two different PC. Both have same (copy from one PC to another) Glassfish (both have also latest JAVA version) server with following flags: -XX:+DisableExplicitGC, XX:MaxGCPauseMillis=200, -Xmx512m, -Xms512m,...

memory content not erased after deleting my pointer (on a simple example) [duplicate]

This question already has an answer here: Can a local variable's memory be accessed outside its scope? 16 answers Here is a simple of example of a question I have: I create a pointer of integer (value 5), I print the pointer (hence the address) of the memory case...

Why does the JVM have the iconst_2 - iconst_5 opcodes?

While reading the JVM specification (as one does), I was very surprised when I came across the 7 iconst_<i> opcodes. After all, there is only one byte to play with. I very rarely write the literals for 2, 3, 4 or 5 in my code. I can understand why -1,...

free() and mxFree() in MATLAB - freeing memory twice

Good day, I have the following code which has given me problems for a day already. I have debugged it, and it works fine until trying to free the memory. The free() function should be called at the end of the execution automatically, so I commented the mxFree() code out,...

How to get current memory page size in C#

I need to determine the memory page size in C# without using "Kernel32.dll" SYSTEM_INFO si; GetSystemInfo(&si); This is very important because the code should be cross platform and we should not have platform specific code. Is there any .NET class who provides that data? Thanks, Valentin...

How are Strings created and stored in Java?

To understand how String objects are created and stored, I tried the following program and I see output against which I have query. Can somebody please help? package corejava.immutable; public class StringTester { public static void main(String[] args) { // TODO Auto-generated method stub String s1 = "Omkar Patkar"; String...

Failed to create JVM in android studio

I set the JAVA_HOME and PATH in environment variables but now android studio is giving to me a new error. here is error: Failed to create JVM:error code -6. JVM path:C:\Program Files\java\jdk1.9.0 if you already have a 64-bit JDKinstalled, define a JAVA_HOME variable in ...

Heap size issue on migrating from Solr 5.0.0 to Solr 5.1.0

I have a Solr 5.0.0 in production with a custom heap size like this SOLR_JAVA_MEM="-Xms2g -Xmx2g" When I tried to migrate to Solr 5.1.0 with the same configuration and start the server it returned a OutOfMemoryError. Looking to the Solr API I saw that the heap size was set to...

Is there a difference between new List() and new List(0)

Is there a difference between new List<T>() and new List<T>(0) ? May be this is a micro-optimization, but the idea is to understund the difference in term of memory allocation....