Monthly Archives: May 2011

Increasing stack size for a C program

In java, when there is a problem, usually with heap, you simply throw in -Xmx and for stack, it would be -Xss. But what about a C program? Recently I ran into this problem. I had a C program which worked fine on one enterprise class Linux machine but didn’t work on my personal computer based on Mac OS X (Snow Leopard). First I didn’t understand what was going since the error wasn’t obvious but soon I realized that the problem was with the stack as it happened for larger values of input. When you do

ulimit -s

you would notice something like

8192

Then setting

ulimit -s hard

and then checking

ulimit -s

you would notice something like

65532.

So, with this increased stack size, I was able to run the program for even higher input values but soon ran into the same issue as the input value increased even further. Then, searching the web indicated that it’s possible to actually provide a hint at the time of compilation of how much stack size the program would need. So, all I had to do was to compile the program as follows

g++ -O3 -Wl,-stack_size,0xf000000 -o my_program my_program.cc

The 0xf000000 above is the stack size. It’s probably way more than I need. This solved my problem. While this is a good workaround, I think the Java solution is better as it doesn’t require recompiling the code. But then, java is an interpreter, so it has that extra flexibility.

Leave a comment

Filed under C/C++, Java

Dear Paypal, Stop Wasting My Time

Every time I login to my Paypal account, the first thing I am greeted with is

paypal wasting my time

But I don’t want to join BillMe later now or ever. Can’t I just say once, that I am not interested? Why do I have to keep wasting my time and a click each time I login to Paypal? I sent the same through their contact form, almost 24 hrs back, yet to get a reply, but this is annoying me. Hence this post.

Update: After a day, I didn’t get any reply from Paypal but I no longer see the BillMe later screen as soon as I login.

Leave a comment

Filed under PayPal, Uncategorized