heap

Where are static variables stored (data segment or heap or BSS)?

梦想的初衷 提交于 2020-01-15 08:30:50
问题 I obtained conflicting Opinions about static variable storage. Opinion 1 : "A stack static variable stores its value in the heap " Opinion 2 : "A stack static variable stores its value in the data segment". I am confused with these conflicting answers. Where exactly are static variables stored? I am expecting an answers with references (text books, authentic tutorials, etc.). Static variables have two types: static variables declared inside a function. global (declared outside function)

Is there a upper limit on stack frame size

倖福魔咒の 提交于 2020-01-14 13:36:45
问题 We have an out of memory error for a heap but ( just asking out of curiosity ) is there an equivalent limit on size of an individual stack ? If not then what prevents such an overflow if excess memory is needed by a stack frame ( like thousands of local variable etc ) ? 回答1: If a thread requests more stack space than it has available it receives a StackOverflowError. http://docs.oracle.com/javase/7/docs/api/java/lang/StackOverflowError.html The size of an individual stack frame is determined

Is there a upper limit on stack frame size

荒凉一梦 提交于 2020-01-14 13:36:31
问题 We have an out of memory error for a heap but ( just asking out of curiosity ) is there an equivalent limit on size of an individual stack ? If not then what prevents such an overflow if excess memory is needed by a stack frame ( like thousands of local variable etc ) ? 回答1: If a thread requests more stack space than it has available it receives a StackOverflowError. http://docs.oracle.com/javase/7/docs/api/java/lang/StackOverflowError.html The size of an individual stack frame is determined

How to properly set the JVM options in a flexible GAE application

£可爱£侵袭症+ 提交于 2020-01-14 10:33:12
问题 the following is my app.yaml file for a GAE flexible Java 8 / Jetty application. runtime: java env: flex manual_scaling: instances: 1 runtime_config: # Optional jdk: openjdk8 server: jetty9 resources: cpu: 2 memory_gb: 4.0 env_variables: JAVA_HEAP_OPTS: -Xms3072M -Xmx3072M health_check: enable_health_check: False handlers: - url: /.* script: this field is required, but ignored For some reason the JAVA_HEAP_OPTS value is not used when deploying the app. A least I don't think it's used, because

Why are all my bitmaps upsampled 200%?

主宰稳场 提交于 2020-01-13 09:51:28
问题 I'm having severe memory issues in my application [1]. In order to investigate this, I took heapdumps of my app at different states. I saw that some bitmaps were taking huge amounts of memory. I wrote a small tool [2] that decodes the byte arrays to Windows bitmap files (.bmp), so that I can see the bitmaps and compare them to the files I have in my res/drawable folder. What I discovered is that all my files are upsampled twice. I first checked with the biggest one had: a byte array buffer of

Is it on the Stack or Heap?

邮差的信 提交于 2020-01-13 02:46:07
问题 I have some C code that is something of a puzzle. For a reason to do with this code, I'm wondering how I can tell if a struct object is ending up on the heap or stack? The objects are not being created with malloc or calloc . They start their life in the form of an array. For the purposes of this post, I'm going to call the struct Emp. Emp myEmp[6]; /* Each myEmp[?] item is populated in code */ The objects are sorted and manipulated in various ways and at some point, the objects are copied

Heap Inspection Security Vulnerability

拟墨画扇 提交于 2020-01-12 14:37:18
问题 I have run my java app against the checkmarx tool for security vulnerability and it is constantly giving an issue - Heap Inspection, for my password field for which I use a character array. It doesnt give any more explanation than just pointing out the declaration of the password field. private char[] passwordLength; Could anyone help me out here, what more can I look for resolving this? 回答1: Heap Inspection is about sensitive information stored in the machine memory unencrypted, so that if

Heap Inspection Security Vulnerability

半世苍凉 提交于 2020-01-12 14:34:34
问题 I have run my java app against the checkmarx tool for security vulnerability and it is constantly giving an issue - Heap Inspection, for my password field for which I use a character array. It doesnt give any more explanation than just pointing out the declaration of the password field. private char[] passwordLength; Could anyone help me out here, what more can I look for resolving this? 回答1: Heap Inspection is about sensitive information stored in the machine memory unencrypted, so that if

What is the aligment requirements for sys_brk

一曲冷凌霜 提交于 2020-01-11 10:42:29
问题 I'm using sys_brk syscall to dynamically allocate memory in the heap. I noticed that when acquiring the current break location I usually get value similar to this: mov rax, 0x0C mov rdi, 0x00 syscall results in rax 0x401000 The value usually 512 bytes aligned. So I would like to ask is there some alignment requirements on the break value? Or we can misalign it the way we want? 回答1: The kernel does track the break with byte granularity. But don't use it directly for small allocations if you

Malloc and scanf

馋奶兔 提交于 2020-01-11 09:25:11
问题 I'm fairly competent in a few scripting languages, but I'm finally forcing myself to learn raw C. I'm just playing around with some basic stuff (I/O right now). How can I allocate heap memory, store a string in the allocated memory, and then spit it back out out? This is what I have right now, how can I make it work correctly? #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *toParseStr = (char*)malloc(10); scanf("Enter a string",&toParseStr); printf("%s"