Update the code and tools provided in all my posts (c++,2014.09)

Source: Internet
Author: User

To make it easier to manage the various code and tool resources involved in the blog post, these resources are now migrated to GitHub, where interested people can go to download.

C++

1, "General high-performance Windows Socket component Hp-socket v3.2.3 officially released"

Design and implementation of the IOCP-based universal asynchronous Windows Socket TCP High Performance service-side component

Design and implementation of the universal asynchronous Windows Socket TCP client Component

Summary: Writing a Windows Socket TCP client is not really difficult, and Windows provides 6 I/O communication models for everyone to choose from. But we've seen a lot of client programs that mix Socket communications with business logic, and the scissors keep messing around. Each program is copy/parse similar code to modify, it is a bit of a feeling. So this seat used some leisure time to write a general purpose asynchronous Windows Socket TCP High performance service-side component based on IOCP and a universal asynchronous Windows Socket TCP client component for your crossing, hoping to inspire everyone.

  Hp-socket is a general-purpose, high-performance TCP/UDP communication framework that includes server-side components, client components, and agent components, and is widely used in TCP/UDP communication systems in a variety of applications, from C + +, C #, Delphi, E (Easy language), Java, Programming language interfaces such as Python. Hp-socket completely encapsulates the communication layer, the application does not have to focus on any details of the communication layer, and Hp-socket provides an API interface based on the event notification model, which can be easily and efficiently integrated into the old and new applications.

In order to enable users to quickly learn and use Hp-socket, quickly grasp the framework of design ideas and use of methods, we have carefully crafted a large number of Demo samples (such as: PUSH model example, pull model example, performance test examples and other programming language examples). Hp-socket is currently running on the Windows platform and will implement cross-platform support in the future.

Resources: Please visit the project homepage ^_*

2, "Windows C + + application common Log component (component and test program download)"

Summary: Writing a common logging component should focus on three aspects: functionality, availability, and performance. Below, this seat details the considerations for these aspects when designing the log component:

    • Function: The purpose of this log component is to meet the requirements of most application logging-output logs to a file or send to an application, and does not provide some complex but infrequently used features
    • Availability: This log component focuses on usability and makes it easy and enjoyable for users to use.
    • Performance: Performance is a tough of whether a component is worth using, and this component is designed and encoded to maximize performance optimization

Resources: Please visit the project homepage ^_*

3, "How to develop good C + + programming habits (a)--memory management"

Summary: Talking about the memory management of C + + + seems daunting, full screen new/delete/malloc/free,output window endless Memory Leak warning, program weird 0X00000004 pointer abnormal, as if back to that year we cried together Day, can you hold it? In fact, the reality is not as bad as you think. As long as you pay a little, spend a little thought, yes! Just a little bit-- using C + + classes to encapsulate memory access will solve most of your troubles and benefit you for life. In the case of Windows programs, there are several main memory management methods:

    • virtual Memory (Vsan)
    • default heap and private heap (Process heap & Private Heap)
    • memory-mapped files (file Mapping)
    • The process stack (heap, in fact, uses malloc () or the default new operator to cut a small piece of meat in the process Heap ^_^)
    • stack (stack, memory is automatically managed by caller or callee)

Resource: HTTPS://GITHUB.COM/LDCSAA/VC-COMMON-SRC (source code in COMMON/SRC directory)

4, "Implementation of the WIN32 program message map macro (similar to MFC)"

Absrtact: For message map macros, needless to say, the people who have used MFC are very clear. But there are many programs for various reasons and do not use MFC, so this post discusses how to implement the MFC-like message mapping macros in the WIN32 program. In fact, the Windows header file "WindowsX.h" (Note: not "Windows.h") provides some useful macros to help us implement the message map. This block is also based on this header file for message mapping.

resource:https://github.com/ldcsaa/vc-common-src(source code in common/src/win32helper.h file)

5, "using macro C + + Singleton mode"

Abstract: The Singleton design pattern is widely used and is implemented simply by privatizing several constructors, the "operator =" operator, and providing a static method of creation and destruction. But it is not tolerated to write these identical codes for each class, so this block uses macros to encapsulate the entire Singleton pattern, whether it is the definition of a class or the simplicity of the use of a class.

resource:https://github.com/ldcsaa/vc-common-src (source code in common/src/singleton.h file)

6. "C + + encapsulation private heap"

Summary: Private heap is a memory-memory mechanism provided by Windows, and for applications that require frequent allocation and release of dynamic memory, the private heap is a great way to improve application performance, using it to reduce new/malloc Call queue contention and a memory hole.

Resource: HTTPS://GITHUB.COM/LDCSAA/VC-COMMON-SRC (source code in common/src/privateheap.h file)

7. "Windows Program memory leak Detection Tool based on CRT debug"

Summary: Windows program memory leak detection is a very important task, GUI-based applications usually have a memory leak report at the end of debugging, but the information in this report is not comprehensive and cannot be located to the specific line number that generated the leak. In fact, to implement a memory leak detection tool is a very simple thing, but read a lot of examples of online writing, there are two common problems:

    • It is either poorly thought-out, one that can be used in an environment, but not a good job in another environment, or the output of a vulnerability report is unreasonable.
    • It is either too conservative, for example: there is absolutely no need to protect the _malloc_dbg () and _free_dbg () with CriticalSection before and after the call (tracking the code of new and malloc in a multithreaded environment).

Resource: HTTPS://GITHUB.COM/LDCSAA/VC-COMMON-SRC (in source code common/src/debug/win32_crtdbg.h file)

Update the code and tools provided in all my posts (c++,2014.09)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.