Escape analysis in Java

With this version of java -XX:+DoEscapeAnalysis results in far less gc activity and 14x faster execution. $ java -version java version “1.6.0_14” Java(TM) SE Runtime Environment (build 1.6.0_14-b08) Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing) $ uname -a Linux xxx 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686 GNU/Linux Without escape … Read more

How to get the caller class name inside a function of another class in python?

Well, after some digging at the prompt, here’s what I get: stack = inspect.stack() the_class = stack[1][0].f_locals[“self”].__class__.__name__ the_method = stack[1][0].f_code.co_name print(“I was called by {}.{}()”.format(the_class, the_method)) # => I was called by A.a() When invoked: ➤ python test.py A.a() B.b() I was called by A.a() given the file test.py: import inspect class A: def a(self): … Read more

What does “ulimit -s unlimited” do?

When you call a function, a new “namespace” is allocated on the stack. That’s how functions can have local variables. As functions call functions, which in turn call functions, we keep allocating more and more space on the stack to maintain this deep hierarchy of namespaces. To curb programs using massive amounts of stack space, … Read more

Maximum Stack Size for C/C+ Program?

What is the maximum size of the stack? Depends on implementation. One to few megabytes is typical on PC nowadays. Is it fixed for every program/computer? It’s typically fixed on linking but standard does not define that it is. Some operating systems can limit the stack during runtime too (RLIMIT_STACK on linux for example). Can … Read more