stack

How to check whether a vector is LIFO/FIFO decreasing

岁酱吖の 提交于 2019-12-05 02:57:50
Suppose I have a data.table where each row consists of two vectors: A 'pre-subtraction' vector. A 'post-subtraction' vector. The pre-subtraction is the left-half most column and the post- is the right-most columns, with the suffix "prm" at the end. For example: #Sample Data set.seed(2) fill = data.table(n=1:7) Tp=3 for(t in 1:Tp){ set(x = fill, j = paste0('v',t), value = sample(0:10,7)) } fill[1,paste0('v',3):=0] fill[5,paste0('v',2):=0] fill[5,paste0('v',3):=0] for(t in 1:Tp){ fill[,paste0('v',t,'prm'):=get(paste0('v',t))] } fill[1,paste0('v',1,'prm'):=0] fill[2,paste0('v',2,'prm'):=1] fill[5

What is thread stack size option(-Xss) given to jvm? Why does it have a limit of atleast 68k in a windows pc?

谁说胖子不能爱 提交于 2019-12-05 02:49:16
问题 I have seen JVM option -Xss - What does it do exactly? this link, but my question is how is this option useful. Because, if we set a very minimum limit to the -Xss value, maybe the threads are not going to work properly as it may throw stackOverflow error most of the times. Why is there a 64k limit at least for this value? How i got this 64k limit is when i was trying to configure the runtime vm options on the IntelliJ iDE, I tried to give some thing like 10k and it popped up this error

Stack<> implementation in C#

人盡茶涼 提交于 2019-12-05 02:45:09
I've recently been implementing a recursive directory search implementation and I'm using a Stack to track the path elements. When I used string.Join() to join the path elements, I found that they were reversed. When I debugged the method, I looked into the stack and found that the elements themselves were reversed in the Stack's internal array, ie the most recently Push()ed element was at the beginning of the internal array, and the least recently Push()ed element was at the end of the internal array. This seems ass-backward and very counter-intuitive. Can somebody please tell me why

Hacking Challenge - locating vulnerability in the code

本小妞迷上赌 提交于 2019-12-05 02:12:28
问题 My Friend recently completed a hacking challenge and sent it to me (binary and source). I wanted to ask here before I asked him for tips as I want to do it myself :) I've been going through it but I am struggling to find the vulnerability. #include <alloca.h> #include <stdio.h> #include <string.h> #include <stdlib.h> static void usage(const char *argv0) { printf("Build your own string!\n"); printf("\n"); printf("Usage:\n"); printf(" %s length command...\n", argv0); printf("\n"); printf("Each

Stack overflow - static memory vs. dynamic memory

随声附和 提交于 2019-12-05 01:53:30
问题 If you write int m[1000000]; inside the main function of C/C++, it will get a runtime error for stack overflow. Instead if you write vector<int> m; and then push_back 1000000 elements there, it will run fine. I am very curious about why this is happening. They both are local memory, aren't they? Thanks in advance. 回答1: Yes, the vector itself is an automatic (stack) object. But the vector holds a pointer to its contents (an internal dynamic array), and that will be allocated on the heap (by

Is there a stack space for every thread?

吃可爱长大的小学妹 提交于 2019-12-05 01:38:08
If I understand correctly the stack is for local primities and references to the objects in the heap. So what happens if you have more than one threads? Do they share the same stack space at the same time (but different areas) or does the JRE switch contexts and load-deload the stack content when switching between threads? Or does the JRE allocate separate stacks for each threads? Or does the JRE allocate separate stacks for each threads? Conceptually yes. (See this JVM spec link , for example.) How the spec's conceptualization gets implemented in a particular JVM is ... implementation

Running out of ValueType stack space

社会主义新天地 提交于 2019-12-05 00:55:27
问题 My understanding is that each new thread in .Net allocates 1MB of stack space. Further my understanding is that value types are stored on the stack rather then the heap... So my question is this; does this behavior mean that any ValueType variable declarations are limited to 1MB of storage space? That the more ValueTypes you have declared in your current scope the smaller the callstack can effectively be and at some point does this mean that declaring (for the sake of argument) ~260,000 ints

Inferring a method's stack memory use in Java

浪尽此生 提交于 2019-12-05 00:46:34
I'm trying to determine how much stack memory each method consumes when running. To do the task, I've devised this simple program that will just force a StackOverflowError , public class Main { private static int i = 0; public static void main(String[] args) { try { m(); } catch (StackOverflowError e) { System.err.println(i); } } private static void m() { ++i; m(); } } printing an integer telling me how many times m() was called. I've manually set the JVM's stack size( -Xss VM parameter) to varying values (128k, 256k, 384k), obtaining the following values: stack i delta 128 1102 256 2723 1621

numpy-equivalent of list.pop?

人走茶凉 提交于 2019-12-04 23:33:44
Is there a numpy method which is equivalent to the builtin pop for python lists? Popping obviously doesn't work on numpy arrays, and I want to avoid a list conversion. There is no pop method for NumPy arrays, but you could just use basic slicing (which would be efficient since it returns a view, not a copy): In [104]: y = np.arange(5); y Out[105]: array([0, 1, 2, 3, 4]) In [106]: last, y = y[-1], y[:-1] In [107]: last, y Out[107]: (4, array([0, 1, 2, 3])) If there were a pop method it would return the last value in y and modify y . Above, last, y = y[-1], y[:-1] assigns the last value to the

ARM GCC generated functions prolog

巧了我就是萌 提交于 2019-12-04 22:50:44
问题 I mentioned that ARM toolchains could generate different function prologs. Actually, i saw two obj files (vmlinux) with completely different function prologs: The first case looks like: push {some registers maybe, fp, lr} (lr ommited in leaf function) The second case looks like: push {some registers maybe, fp, sp, lr, pc} (i can confuse the order) So as i see the second one pushes additionally pc and sp. Also i saw some comments in crash utility (kdump project) where was stated, that kernel