RSS feed [root] /c /weblog /languages




login:

password:

title search:




 


Tue Jan 24 23:56:36 HKT 2012

c



(google search) (amazon search)
second
download zip of files only

Tue Jan 24 23:56:36 HKT 2012 From /weblog/languages/c

memory issue


Personal memo about C++ memory management, from a Java developer, contain some rule of thumb tips - http://karussell.wordpress.com[..]c-trying-to-understand-memory-mangement/

Tutorial of valgrind - http://www.thegeekstuff.com/2011/11/valgrind-memcheck/

Disucssion of GC in C++ - http://herbsutter.com[..]10/25/garbage-collection-synopsis-and-c/

Core dump with few variable declaration removed - http://techblog.rosedu.org/c-extern-internals.html

Tracking memory allocation - http://jfdube.wordpress.com[..]-management-part-2-allocations-tracking/

We have a process running fine for several years and recently have core dump everytime starting it up. here is the stacktrace:

(gdb) backtrace
#0 0xfe34251c in realfree () from /lib/libc.so.1
#1 0xfe342e28 in cleanfree () from /lib/libc.so.1
#2 0xfe341f5c in _malloc_unlocked () from /lib/libc.so.1
#3 0xfe341e50 in malloc () from /lib/libc.so.1
#4 0xfe38f534 in _findbuf () from /lib/libc.so.1
#5 0xfe384f38 in _doprnt () from /lib/libc.so.1
#6 0xfe3886fc in fprintf () from /lib/libc.so.1
#7 0x164f64 in _ZN7LogBook8WriteLogEPcS0_i (this=, pType=0x5c00e8 "INFO",
pMsg=0x6b0b14 "main. Database=XXXXXX. Performing Login to XXXX. user=SYSTEM.", nFile=0) at Util.cpp:164
#8 0x164e28 in _ZN7LogBook9PromptLogEPciS0_i (this=, pType=0x5c00e8 "INFO",
nType=3, pMsg=0x0, nFile=0) at Util.cpp:136
#9 0x14a364 in main (argc=3, argv=0xffbef5bc) at XXXX.cpp:385
(gdb)

Eventaully we found out the reason is the class LogBook is singleton, and it reuse few char* buffer internally, without delete and new in between, after adding delete and new for transaction, the process run correctly, as a rule of thumb, singleton is evil for most of the cases.

(google search) (amazon search)


Mon Jan 16 22:17:35 HKT 2012 From /weblog/languages/c

concurrency


Lightweight thread, actually a simple greem thread - http://www.sics.se/~adam/pt/index.html http://www.sics.se/~adam/pt/pt-1.4-refman/ http://drdobbs.com[..]int?articleId=229601338&siteSectionName=

How Fork work - http://stackoverflow.com[..]1/how-is-fork-working-when-children-fork

Comparing OpenMP and Intel TBB - http://www.ddj.com[..]UQSNDLPCKHSCJUNN2JVN?articleID=214303519

Tutorial about TBB - http://software.intel.com[..]es-with-intel-threading-building-blocks/

Multi-thread optimzated malloc - http://groups.google.com[..]wse_thread/thread/c1ec1fa08c744a8c?hl=en

Introduction to 2 static analysis tool to check OpenMP potential issue, like racing condition - http://software.intel.com[..]tudio-vivamp-and-intel-cc-parallel-lint/

Light weigth lock provide by Linux kernal - http://lwn.net/Articles/360699/

http://software.intel.com[..]uilding-blocks-openmp-or-native-threads/

OpenMP vs. POSIX - http://www.dalkescientific.com[..]/2012/01/13/openmp_vs_posix_threads.html

(google search) (amazon search)


Wed Dec 21 22:12:32 HKT 2011 From /weblog/languages/c

misc


The state of C - http://drdobbs.com[..]int?articleId=223000089&siteSectionName=

Reference of C libraries - http://programmers.stackexchange.com[..]out-there-that-include-the-gnu-c-library

Reflection for C - http://altdevblogaday.com[..]/25/reflection-in-c-part-1-introduction/

Interesting idea, integrate C and lisp - http://voodoo-slide.blogspot.com/2010/01/amplifying-c.html

How to prevent code duplication in C - http://groups.google.com[..]read/thread/b4d029524579944e?hl=en&pli=1

Why need header - http://stackoverflow.com[..]7/why-does-c-need-a-separate-header-file

How to monitor file usage - http://www.thegeekstuff.com/2010/04/inotify-c-program-example

C programming questions - http://stevenkobes.com/ctest.html

Taking input for compilation - http://susam.in/blog/compiler-taking-input-while-compiling/

Understand lvalues and rvalues - http://eli.thegreenplace.net[..]standing-lvalues-and-rvalues-in-c-and-c/

(google search) (amazon search)


Fri Nov 04 23:27:55 HKT 2011 From /weblog/languages/c

cpp


Element of Modern C++ Style, new language feature of C++11 - http://www.herbsutter.com/elements-of-modern-c-style/ , complete tutorial of C++11 - http://www2.research.att.com/~bs/C++0xFAQ.html . And also list of document - http://punchcard.wordpress.com/2011/11/01/c11-c0x-documentation/

How to embed script in C++ - http://dobbscodetalk.com[..]ing-Language-in-CPlusPlus.html&Itemid=29

Is CPP that crap? http://lwn.net/Articles/249460/

lint for c++ - http://groups.google.com[..]wse_thread/thread/b895a69d84ff909d?pli=1

http://www.ddj.com/cpp/archives.jhtml

Namespace tutorial - http://www.dreamincode.net/forums/showtopic59841.htm

http://loadcode.blogspot.com/2009/11/advantages-of-c-over-c.html

Delete a pointer in iterator - http://groups.google.com[..]wse_thread/thread/cfff42bf0c8a569c?hl=en

Discussing about using standard container without copy constructor - http://groups.google.com[..]wse_thread/thread/50e174f87d0261cd?hl=en

(google search) (amazon search)


Sun Oct 30 02:44:15 HKT 2011 From /weblog/languages/c

network


Sample code of flooding network with raw socket - http://www.lainoox.com/c-syn-flood-raw-socket/

C99 socket programming - http://gustedt.wordpress.com[..]m/2011/10/24/socket-programming-and-c99/

(google search) (amazon search)


Sun Oct 23 01:41:00 HKT 2011 From /weblog/languages/c

optimization


Optimizing Pixomatic for x86 Processors part II

http://www.ddj.com/architect/184405765
http://www.ddj.com/184405807
http://www.ddj.com/184405848
http://www.home.comcast.net[..]tom_forsyth/papers/pixomatic_gdc2004.ppt

Fast way to add null after each char from a string - http://groups.google.com[..]wse_thread/thread/51d0f84dd22ad734?hl=en

Move 80 bytes asap - http://codereview.stackexchange.com[..]520/copying-80-bytes-as-fast-as-possible

(google search) (amazon search)


Thu Oct 20 23:30:54 HKT 2011 From /weblog/languages/c

ide


http://programmers.stackexchange.com[..]-lightweight-c-editor-or-ide-for-windows

(google search) (amazon search)


Wed Oct 19 20:19:33 HKT 2011 From /weblog/languages/c

compiler


Template variable name lookup explain - http://groups.google.com[..]+/browse_thread/thread/e8755b9cb8f0fd61#

How link work, and how to debug if thing doesn't work - http://www.thegeekstuff.com/2011/10/gcc-linking

How to create static / dynamic library - http://www.lainoox.com/c-shared-libraries-static-dynamic/

(google search) (amazon search)


Sat Oct 15 11:37:46 HKT 2011 From /weblog/languages/c

bug


incorrect comparison of 64bit pointers - http://www.azulsystems.com[..]/2011-08-28-just-fixed-a-20-year-old-bug

(google search) (amazon search)


Mon Oct 03 23:45:59 HKT 2011 From /weblog/languages/c

cuda


Using CUDA with Java - http://www.javacodegeeks.com/2011/09/gpgpu-java-programming.html

C library that allow programmer use the power of NVIDIA GPUs

http://www.nvidia.com/object/cuda_home.html
http://www.ddj.com[..]articleID=207200659&dept_url=/architect/
http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/
http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/

CUDA Data Parallel Primitives Library - http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/

CUDA tutorial - http://www.ddj.com/architect/207200659



(google search) (amazon search)


Mon Sep 26 23:59:58 HKT 2011 From /weblog/languages/c

gui


Example of using DBus - http://brunogirin.blogspot.com[..]m/2011/01/d-bus-experiments-in-vala.html

(google search) (amazon search)


Sat Aug 06 00:35:30 HKT 2011 From /weblog/languages/c

string


One big problem of strncpy, it doesn't allow you control the behaviour when overflow... http://blog.liw.fi/posts/strncpy/

Problem of atoi - http://www.lainoox.com/ascii-to-integer-atoi-in-c/

(google search) (amazon search)


Wed Jan 19 14:27:04 HKT 2011 From /weblog/languages/c

system


Give hint to kernal about how use swap memory - http://linux.die.net/man/2/madvise

Recursive ls - http://synesis.com.au/software/recls/

Socket programming tutorial - http://www.codedanger.com/caglar/?p=210 http://simplestcodings.com/2011/01/18/ping/

Discussion about making flush() reliable - http://groups.google.com[..]wse_thread/thread/71da1187ec3b0445?hl=en

(google search) (amazon search)


Sat Jan 15 10:08:41 HKT 2011 From /weblog/languages/c

io


First Disk Seek on multi-core system - http://www.1024cores.net/home/scalable-architecture/wide-finder-2

(google search) (amazon search)


Fri Mar 06 02:15:08 HKT 2009 From /weblog/languages/c

profiler


gprof - http://www.ibm.com/developerworks/library/l-gnuprof.html

(google search) (amazon search)