Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  3 meanings of Stack

We may frequently see stack when we read programming books. But many times we may be confused about the different meanings of it. This term actually has three common meanings. Here we explain the three different meanings of Stack in programming.1. Data structureThe first meaning of Stack defines a method for storing data. Its feature is LIFO9Last In First Out). In this data structure, data are accumulated level by level. The data last put in is added at the top of the stack. When using the data, the top one is first popped out from the stack.There are usually some methods related to this data ...

3,046 1       MEMORY STACK DATA STRUCTURE


  Server monitoring shell scripts

There are many open source server monitoring software such as cacti and nagios. Besides these, can we write our own shell scripts to monitor them? The shell scripts written by ourselves can fulfill our special requirements better and have a more detailed coverage.Below are some commonly used shell scripts used by Evangelist, an Oracle DBA. 1. Check network gateway traffic#!/bin/bash#network#Mike.Xuwhile : ; do time='date +%m"-"%d" "%k":"%M' day='date +%m"-"%d' rx_before='ifconfig eth0|sed -n "8"p|awk '{print $2}'|cut -c7-' tx_before='ifconfig eth0|sed -n "8"p|awk '{print $6...

46,079 2       MEMORY SHELL CPU SERVER MONITOR


  malloc/free and new/delete in C++

malloc and free are C++/C language standard library functions, while new/delete are operator of C++. They can be used to allocate dynamic memory and free memory in C++ programs malloc/free can not meet the requirements of dynamic objects creation. Object needs to call the constructor to initialize the object when creating, the object needs to call the destructor before it is destroyed  Since malloc() and free() are library functions rather than operators, the compiler has no control permissions on them, so it can not impose the task of object construction and destruction on malloc() and f...

14,602 1       MEMORY C++ DELETE FREE MALLOC NEW


  In-memory key-value store in C, Go and Python

Subtitle: Wow Go’s net library is fastOn paternity leave for my second child, I found myself writing an in-memory hashmap (a poor-man’s memcached), in Go, Python and C. I was wondering how hard it would be to replace memcached, if we wanted to do something unusual with our key-value store. I also wanted to compare the languages, and, well, I get bored easily!The code is on github as Key-Value-Polyglot.Each version implements enough of the get and set commands from the memcached protocol that we can test them with a memcached client.If you write a version in a different language (...

4,413 0       KEY-VALUE MEMORY C PYTHON GO


  Buffcacher

What should a ‘cache’ be? It means a lot of things, but to my mind the default programming type should be:“keep around expensive-to-generate bits of read-only data in case we need them again, or until the computer really needs that RAM for something else”I was writing a custom video editing program in Python (interesting choice of language for that problem) and I wanted to cache decoded frames; but I just wasn’t happy with the memory management of explicit caches.  It means making a decision about how much RAM to ring-fence for something without having g...

2,472 0       MEMORY WEB BROWSER RAM CACHE BUFFER


  PHP's Output Buffering

While profiling our application I came across a a rather strange memory usage by the ob_start() function. We do use ob_start() quite a bit to defer output of data, which is a common thing in many applications. What was unusual is that 16 calls to ob_start() up chewing through almost 700kb of memory, given that the data being buffered rarely exceeds 1-2kb, this was quite unusual.I started looking at the C code of the ob_start() function and found this interesting bit of code inside php_start_ob_buffer()initial_size = 40*1024;block_size = 10*1024;Which directs PHP to pre-allocate 40kb of data fo...

4,030 0       PHP MEMORY OB_START() SOURCE 40KB


  Why Memorizing is Ineffective

The information-age has burst into life, creating a wake of social change. Young people are growing up faster and more sophisticated, as raw information, tailored-entertainment, and branded-marketing are streamed into their rooms. But this technological exposure has not necessarily made them savvier or more capable of handling tomorrow’s challenges.The debates in public education over “school-choice” and standardized testing have missed the far more important issue. The real choice Americans face is whether students continue to learn only through memorization or whether they...

3,998 0       MEMORY CAREER MEMORIZATION INEFFECTIVE


  The trap of the performance sweet spot

This post is about JavaScript performance but I would like to start it by telling a story that might seem unrelated to JS. Please bear with me if you don’t like C.A story of a C programmer writing JavaScriptMr. C. is a C programmer as you can probably guess from his name. Today he was asked by his boss to write a very simple function: given an array of numbered 2d points calculate vector sum of all even numbered points... He opens his favorite text editor and quickly types something like (I’ll be intentionally skipping some #include boilerplate):typedef s...

2,009 0       JAVASCRIPT MEMORY C LOW LEVEL SWEET SPOT TRAP