# pointers

Published articles for pointers.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Implementing LFU Cache in O(1) Time: A Hands-on Breakdown

DevFeed: [Implementing LFU Cache in O(1) Time: A Hands-on Breakdown](<https://devfeed.tech/articles/implementing-lfu-cache-in-o-1-time-a-hands-on-breakdown-39586.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/34-lfu-cache-o1-implementation/>)

Author: hello@ankit-rana.com

Published: 2026-08-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [Cache](<https://devfeed.tech/topics/cache.md>), [Caching](<https://devfeed.tech/topics/caching.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [cache](<https://devfeed.tech/tags/cache.md>), [caching](<https://devfeed.tech/tags/caching.md>), [implementing](<https://devfeed.tech/tags/implementing.md>), [java](<https://devfeed.tech/tags/java.md>), [lfu](<https://devfeed.tech/tags/lfu.md>), [memory](<https://devfeed.tech/tags/memory.md>), [order](<https://devfeed.tech/tags/order.md>), [performance](<https://devfeed.tech/tags/performance.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [system-design](<https://devfeed.tech/tags/system-design.md>)

### AI overview

This tutorial explains why LRU can evict a frequently requested product during a long-tail burst, then presents an O(1) LFU cache design. It contrasts a naive O(n) eviction scan with an implementation using key-to-node and frequency-to-bucket maps, doubly linked lists, and a minFreq pointer.

### Source excerpt

LFU evicts the least frequently used key rather than the least recently used, which protects a hot key during a long-tail burst that would make LRU drop a bestseller. The naive implementation scans every key to find the minimum frequency, which is O(n) per eviction. The O(1) version inverts the index: a key-to-node map, a frequency-to-bucket map of doubly linked lists, and a minFreq pointer.

## Intuitive Proofs for Linked-List Loop Detection and Majority-Element Algorithms

DevFeed: [Intuitive Proofs for Linked-List Loop Detection and Majority-Element Algorithms](<https://devfeed.tech/articles/relatively-non-obvious-tricks-in-solving-simple-algorithmic-problems-38655.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2024_12_21_relatively_non_obvious_tricks_in_solving_simple_algorithmic_problems/>)

Published: 2024-12-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Algorithms, Complexity](<https://devfeed.tech/topics/algorithms-complexity.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [LeetCode](<https://devfeed.tech/topics/leetcode.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [array](<https://devfeed.tech/tags/array.md>), [code](<https://devfeed.tech/tags/code.md>), [collections](<https://devfeed.tech/tags/collections.md>), [counter](<https://devfeed.tech/tags/counter.md>), [examples](<https://devfeed.tech/tags/examples.md>), [memory](<https://devfeed.tech/tags/memory.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [solutions](<https://devfeed.tech/tags/solutions.md>), [time](<https://devfeed.tech/tags/time.md>)

### AI overview

This tutorial explains why concise solutions to seemingly easy algorithmic problems work. It uses linked-list loop detection with slow and fast pointers and majority-element detection with a counter, emphasizing intuitive proofs over implementation alone.

### Source excerpt

Blowing the dust off LeetCode once again, I found myself, as in the past, struggling with coding relatively simple algorithms. Just like with anything else, if you don't practice for years, you lose some of the hands-on experience. On the positive side, I noticed that for some problems, my new submissions were much better and more concise compared to my old ones. That's an awesome feeling--a tangible measure of growth. While tackling certain easy problems, I realized that "easy" usually just means "doesn't require much code." However, the idea behind the optimal solution might still not be very intuitive. Sure, one can use brute force or additional collections, but in most cases, this leads to either a "time limit exceeded" or an "out of memory" error.

## Transitioning from C and C++ to Rust: A Beginner's Guide

DevFeed: [Transitioning from C and C++ to Rust: A Beginner's Guide](<https://devfeed.tech/articles/transitioning-from-c-and-c-to-rust-a-beginner-s-guide-22268.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2024/10/transitioning-from-c-and-c++-to-rust.html>)

Published: 2024-10-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [beginner](<https://devfeed.tech/tags/beginner.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [c-plus-plus-to-rust](<https://devfeed.tech/tags/c-plus-plus-to-rust.md>), [c-to-rust](<https://devfeed.tech/tags/c-to-rust.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [enums](<https://devfeed.tech/tags/enums.md>), [generics](<https://devfeed.tech/tags/generics.md>), [guide](<https://devfeed.tech/tags/guide.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [memory-safety](<https://devfeed.tech/tags/memory-safety.md>), [migrating-from-c-plus-plus-to-rust](<https://devfeed.tech/tags/migrating-from-c-plus-plus-to-rust.md>), [pattern-matching](<https://devfeed.tech/tags/pattern-matching.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [rust](<https://devfeed.tech/tags/rust.md>), [rust-for-c-developers](<https://devfeed.tech/tags/rust-for-c-developers.md>), [rust-for-c-plus-plus-programmers](<https://devfeed.tech/tags/rust-for-c-plus-plus-programmers.md>), [rust-programming](<https://devfeed.tech/tags/rust-programming.md>), [transitioning-from-c-and-c-plus-plus-to-rust-guide](<https://devfeed.tech/tags/transitioning-from-c-and-c-plus-plus-to-rust-guide.md>), [transitioning-from-c-and-c-plus-plus-to-rust-tutorial](<https://devfeed.tech/tags/transitioning-from-c-and-c-plus-plus-to-rust-tutorial.md>), [transitioning-to-rust](<https://devfeed.tech/tags/transitioning-to-rust.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

A beginner's guide to transitioning from C and C++ to Rust, focusing on Rust's ownership and borrowing model, compile-time memory-safety checks, and type-system features such as enums, pattern matching, and generics.

### Source excerpt

Introduction: As you embark on the journey from C or C++ to Rust, you'll discover a world of exciting possibilities. Rust's emphasis on safety, concurrency, and performance can significantly enhance your programming toolkit. This beginner's guide on transitioning from C and C++ to Rust will provide a structured approach to making that transition, addressing essential concepts and practical applications. Let's dive in! Step 1: Understanding Rust's Ownership Model Concept Overview: Rust's ownership model is its most distinctive feature. Unlike C and C++, where you have pointers and manual memory management, Rust uses a system of ownership with rules that the compiler checks at compile time.

## The memory remains: Permanent memory with systemd and a Rust allocator

DevFeed: [The memory remains: Permanent memory with systemd and a Rust allocator](<https://devfeed.tech/articles/the-memory-remains-permanent-memory-with-systemd-and-a-rust-allocator-35462.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/rust-systemd-memory-remains/>)

Author: Graham King

Published: 2024-01-10T01:54:00Z

Content type: tutorial

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [systemd](<https://devfeed.tech/topics/systemd.md>), [file](<https://devfeed.tech/topics/file.md>), [Linux](<https://devfeed.tech/topics/linux.md>)

Tags: [assembly](<https://devfeed.tech/tags/assembly.md>), [file](<https://devfeed.tech/tags/file.md>), [function](<https://devfeed.tech/tags/function.md>), [glibc](<https://devfeed.tech/tags/glibc.md>), [layout](<https://devfeed.tech/tags/layout.md>), [memory](<https://devfeed.tech/tags/memory.md>), [mmap](<https://devfeed.tech/tags/mmap.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [rust](<https://devfeed.tech/tags/rust.md>), [software](<https://devfeed.tech/tags/software.md>), [systemd](<https://devfeed.tech/tags/systemd.md>)

### AI overview

This tutorial explains how to make Rust objects survive program restarts by combining Rust's Allocator trait with systemd's File Descriptor Store and Linux's memfd_create syscall. The approach stores allocator-backed memory in an in-memory file, maps it with mmap, and restores it after restart.

### Source excerpt

A Rust object that survives program restart thanks to Rust allocators, systemd's file descriptor store, and syscall memfd_create.

## Rust is also C

DevFeed: [Rust is also C](<https://devfeed.tech/articles/rust-is-also-c-35459.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/rust-is-also-c/>)

Author: Graham King

Published: 2022-01-17T17:04:46Z

Content type: comparison

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

Topics: [Rust](<https://devfeed.tech/topics/rust.md>), [C](<https://devfeed.tech/topics/c.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [rust](<https://devfeed.tech/tags/rust.md>), [safety](<https://devfeed.tech/tags/safety.md>), [software](<https://devfeed.tech/tags/software.md>)

### AI overview

This article compares Rust with C, arguing that Rust retains low-level capabilities such as pointer arithmetic, custom memory allocation, and inline assembly while providing conveniences including hash maps, growable arrays, UTF-8 strings, and slice references that carry length information. It also discusses Rust's safety features and direct translation of C code.

### Source excerpt

Safety is boring, let's do pointer arithmetic.

## Learning Zig - Day 3

DevFeed: [Learning Zig - Day 3](<https://devfeed.tech/articles/learning-zig-day-3-38542.md>)

Original publisher: [Read original article](<https://msfjarvis.dev/posts/learning-zig--day-3/>)

Author: Harsh Shandilya

Published: 2021-05-16T06:30:00Z

Content type: tutorial

Language: en

Sources: [Posts on Harsh Shandilya](<https://devfeed.tech/sources/posts-on-harsh-shandilya.md>)

Topics: [Zig](<https://devfeed.tech/topics/zig.md>), [Learning](<https://devfeed.tech/topics/learning.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [type coercion](<https://devfeed.tech/topics/type-coercion.md>), [Code](<https://devfeed.tech/topics/code.md>), [Rust](<https://devfeed.tech/topics/rust.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [enums](<https://devfeed.tech/tags/enums.md>), [learn](<https://devfeed.tech/tags/learn.md>), [learning](<https://devfeed.tech/tags/learning.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [sealed-classes](<https://devfeed.tech/tags/sealed-classes.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [type-coercion](<https://devfeed.tech/tags/type-coercion.md>), [zig](<https://devfeed.tech/tags/zig.md>)

### AI overview

A personal learning log covering the remaining basics of ZigLearn chapter 1. The author discusses Zig pointers, enums, structs, unions, type coercion, floats, and optionals, often comparing Zig's syntax and behavior with Rust and Kotlin.

### Source excerpt

Finishing up the basics

## Programming Language Evolution

DevFeed: [Programming Language Evolution](<https://devfeed.tech/articles/programming-language-evolution-26026.md>)

Original publisher: [Read original article](<https://elizarov.medium.com/programming-language-evolution-ab7d7d2b0d0b?source=rss-4762e889f8fc------2>)

Author: Roman Elizarov

Published: 2020-11-23T16:18:08Z

Content type: opinion

Language: en

Sources: [Stories by Roman Elizarov on Medium](<https://devfeed.tech/sources/stories-by-roman-elizarov-on-medium.md>)

Topics: [Programming](<https://devfeed.tech/topics/programming.md>), [Programming language](<https://devfeed.tech/topics/programming-language.md>), [Code](<https://devfeed.tech/topics/code.md>), [Object-oriented programming (OOP)](<https://devfeed.tech/topics/oop.md>), [C](<https://devfeed.tech/topics/c.md>), [Java](<https://devfeed.tech/topics/java.md>), [Python](<https://devfeed.tech/topics/python.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [evolution](<https://devfeed.tech/tags/evolution.md>), [history](<https://devfeed.tech/tags/history.md>), [improvements](<https://devfeed.tech/tags/improvements.md>), [language](<https://devfeed.tech/tags/language.md>), [loops](<https://devfeed.tech/tags/loops.md>), [oop](<https://devfeed.tech/tags/oop.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>), [programming-language](<https://devfeed.tech/tags/programming-language.md>), [programming-languages](<https://devfeed.tech/tags/programming-languages.md>), [software](<https://devfeed.tech/tags/software.md>)

### AI overview

The article examines how programming languages evolve through gradual improvements that follow changes in programming practice. It uses the transition from GOTOs to structured loops and the adoption of object-oriented patterns, classes, methods, and implicit object references as examples.

### Source excerpt

Photo by Anne Nygård on Unsplash The history of programming languages is ripe with evolution. Existing languages constantly evolve and new languages are created to address the emerging needs. Sometimes there are radical, revolutionary breakthroughs, with a complete paradigm shift, but often there are just gradual improvements and refinements. The latter is the topic of this story. The practice of programming at any given era usually goes ahead of capabilities that programming languages provide, while programming language designers recognize it and catch up to fulfill the demand. Let us see some examples to the point. From GOTOs to the structured code In early languages, you had to write a lot of repetitive code just to do a simple loop. The loop was such a common programming pattern, that it was adopted even by the primitive higher-level languages in the era predating structured programming. So, there was a time when you still had GOTOs in your programming language but a significant fraction of the code had structured loops: 10 LET N=10 20 FOR I=1 TO N 30 PRINT "Hello, World!" 40 NEXT I As we know, the subsequent generation of languages not only added structured IF statements but also made the structure explicit in the source and ended up abolishing GOTOs completely. This kind of evolution can be seen in other areas, too. Objects and pointers Let's take a brief look at OOP. The object-oriented style of programming does not need an object-oriented language. Even nowadays you can find software written in C where methods are just a convention of writing functions whose first parameter is a pointer to the receiver: void Point_move(Point* self, int dx, int dy) { ... } Virtual methods are routinely implemented in pure C, too, explicitly keeping a virtual methods table with references to methods somewhere in the object's structure. However, the rising popularity of object-oriented programming back in the day cemented the growth of languages that incorporated these patterns

## Generics Part 03: Struct Types and Data Semantics

DevFeed: [Generics Part 03: Struct Types and Data Semantics](<https://devfeed.tech/articles/generics-part-03-struct-types-and-data-semantics-22170.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2020/09/generics-03-struct-types-and-data-semantics.html>)

Published: 2020-09-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [data-type](<https://devfeed.tech/tags/data-type.md>), [generics](<https://devfeed.tech/tags/generics.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>), [series](<https://devfeed.tech/tags/series.md>)

### AI overview

This tutorial explains how to declare user-defined struct types with generic fields in Go. It uses a linked-list example to show how generics support one implementation for different data types, and discusses how value and pointer declarations affect data semantics.

### Source excerpt

Series Index Generics Part 01: Basic Syntax Generics Part 02: Underlying Types Generics Part 03: Struct Types and Data Semantics Introduction In the previous post, I showed you how to declare a user-defined type, based on an underlying type. I did this through the progression of writing different versions of the same type using concrete types, the empty interface and then finally, generics. I also provided information on how the compiler was limited in its ability to infer the substitution for the generic type during zero value construction, but it could with initialized construction.

## Red/System: New Features

DevFeed: [Red/System: New Features](<https://devfeed.tech/articles/red-system-new-features-22378.md>)

Original publisher: [Read original article](<https://www.red-lang.org/2020/08/redsystem-new-features.html>)

Author: Nenad Rakocevic (noreply@blogger.com)

Published: 2020-08-20T10:54:00Z

Content type: release

Language: en

Sources: [Red](<https://devfeed.tech/sources/red.md>)

Topics: [Red](<https://devfeed.tech/topics/red.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [arrays](<https://devfeed.tech/tags/arrays.md>), [atomic](<https://devfeed.tech/tags/atomic.md>), [bugfixes](<https://devfeed.tech/tags/bugfixes.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [features](<https://devfeed.tech/tags/features.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [fpu](<https://devfeed.tech/tags/fpu.md>), [ia-32](<https://devfeed.tech/tags/ia-32.md>), [literal-arrays](<https://devfeed.tech/tags/literal-arrays.md>), [math](<https://devfeed.tech/tags/math.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [red-system](<https://devfeed.tech/tags/red-system.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [vfp](<https://devfeed.tech/tags/vfp.md>)

### AI overview

An overview of recent Red/System features, including subroutines, atomic and stack intrinsics, FPU status access, and changes to literal arrays.

### Source excerpt

In the past months, many new features were added to Red/System, the low-level dialect embedded in Red. Here is a sum up if you missed them. Subroutines During the work on the low-level parts of the new Red lexer, the need arised for intra-function factorization abilities to keep the lexer code as DRY as possible. Subroutines were introduced to solve that. They act as the GOSUB directive from Basic language. They are defined as a separate block of code inside a function's body and are called like regular functions (but without any arguments). So they are much lighter and faster than real function calls and require just one slot of stack space to store the return address. The declaration syntax is straightforward: <name>: [<body>] <name> : subroutine's name (local variable). <body> : subroutine's code (regular R/S code). To define a subroutine, you need to declare a local variable with the subroutine! datatype, then set that variable to a block of code. You can then invoke the subroutine by calling its name from anywhere in the function body (but after the subroutine own definition). Here is a first example of a fictive function processing I/O events: process: func [buf [byte-ptr!] event [integer!] return: [integer!] /local log do-error [subroutine!] ][ log: [print-line [">>" tab e "<<"]] do-error: [print-line ["** Error:" e] return 1] switch event [ EVT_OPEN [e: "OPEN" log unless connect buf [do-error]] EVT_READ [e: "READ" log unless receive buf [do-error]] EVT_WRITE [e: "WRITE" log unless send buf [do-error]] EVT_CLOSE [e: "CLOSE" log unless close buf [do-error]] default [e: "<unknown>" do-error] ] 0 ] This second example is more complete. It shows how subroutines can be combined and how values can be returned from a subroutine: #enum modes! [ CONV_UPPER CONV_LOWER CONV_INVERT ] convert: func [mode [modes!] text [c-string!] return: [c-string!] /local lower? upper? alpha? do-conv [subroutine!] delta [integer!] s [c-string!] c [byte!] ][ lower?: [all [#"a" <= c c <= #

## 分布式文件系统的演化

DevFeed: [分布式文件系统的演化](<https://devfeed.tech/articles/article-40973.md>)

Original publisher: [Read original article](<https://blog.joway.io/posts/deep-into-distributed-filesystem/>)

Author: Joway

Published: 2020-06-14T00:00:00Z

Content type: tutorial

Language: zh

Sources: [Random Thoughts](<https://devfeed.tech/sources/random-thoughts.md>)

Topics: [IO](<https://devfeed.tech/topics/io.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Ext4](<https://devfeed.tech/topics/ext4.md>), [hdfs](<https://devfeed.tech/topics/hdfs.md>), [Google](<https://devfeed.tech/topics/google.md>)

Tags: [blocks](<https://devfeed.tech/tags/blocks.md>), [client](<https://devfeed.tech/tags/client.md>), [ext4](<https://devfeed.tech/tags/ext4.md>), [filesystem](<https://devfeed.tech/tags/filesystem.md>), [google](<https://devfeed.tech/tags/google.md>), [hdfs](<https://devfeed.tech/tags/hdfs.md>), [io](<https://devfeed.tech/tags/io.md>), [lease](<https://devfeed.tech/tags/lease.md>), [linux](<https://devfeed.tech/tags/linux.md>), [master](<https://devfeed.tech/tags/master.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [primary](<https://devfeed.tech/tags/primary.md>), [ssd](<https://devfeed.tech/tags/ssd.md>), [tech](<https://devfeed.tech/tags/tech.md>)

### AI overview

This article explains local filesystem structure, including superblocks, inodes, block pointers, and file-size limits, then introduces the evolution and architecture of distributed filesystems. It uses GFS to describe metadata lookup, chunk locations, caching, replication, leases, and client read and write flows, and mentions HDFS as a related implementation.

### Source excerpt

文件系统是操作系统 IO 栈里非常重要的一个中间层，其存在的意义是为了让上层应用程序有一层更加符合人类直觉的抽象来进行文档的读写，而无需考虑底层存储上的细节。 本地文件系统 在讨论分布式文件系统前，我们先来回顾下本地文件系统的组成。 存储结构 在前面一张图里，我们能够看到文件系统直接和通用块层进行交互，无论底层存储介质是磁盘还是 SSD，都被该层抽象为 Block 的概念。文件系统在初始化时，会先在挂载的块存储上的第一个位置创建一个 Super Block：

## Interacting between C libraries and Go using Unsafe

DevFeed: [Interacting between C libraries and Go using Unsafe](<https://devfeed.tech/articles/interacting-between-c-libraries-and-go-using-unsafe-39615.md>)

Original publisher: [Read original article](<https://www.gauravsarma.com/posts/2020-06-11_Interacting-between-C-libraries-and-Go-using-Unsafe-cb8b460d4f0c>)

Published: 2020-06-11T00:00:00Z

Content type: tutorial

Language: en

Sources: [Gaurav Sarma's Blog](<https://devfeed.tech/sources/gaurav-sarma-s-blog.md>)

Topics: [C](<https://devfeed.tech/topics/c.md>), [Go Language](<https://devfeed.tech/topics/go-language.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [go](<https://devfeed.tech/tags/go.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [system-programming](<https://devfeed.tech/tags/system-programming.md>)

### AI overview

This tutorial explains how to reuse C library data structures and methods from Go using the unsafe package. It discusses differences between C and Go memory management, converting C strings and pointers, and casting C data into corresponding Go structures.

### Source excerpt

Suppose we have a C lib where we have defined various data structures and methods. Due to some reason or constraint, there needs to be a Golang process which has to reuse the structures mentioned in the C lib...

## Why Go's json.Unmarshal Requires a Pointer to a Pointer

DevFeed: [Why Go's json.Unmarshal Requires a Pointer to a Pointer](<https://devfeed.tech/articles/fatih-s-question-20832.md>)

Original publisher: [Read original article](<https://dave.cheney.net/2020/05/16/fatihs-question>)

Author: Dave Cheney

Published: 2020-05-16T11:31:37Z

Content type: tutorial

Language: en

Sources: [Dave Cheney](<https://devfeed.tech/sources/dave-cheney.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [JSON](<https://devfeed.tech/topics/json.md>)

Tags: [go](<https://devfeed.tech/tags/go.md>), [json](<https://devfeed.tech/tags/json.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

A Go tutorial explains why JSON decoding requires passing a pointer to the caller's value, including why a pointer to a pointer is needed in one case.

### Source excerpt

A few days ago Fatih posted this question on twitter. I'm going to attempt to give my answer, however to do that I need to apply some simplifications as my previous attempts to answer it involved a lot of phrases like a pointer to a pointer, and other unhelpful waffling. Hopefully my simplified answer can [...]

## Debugging hidden memory leaks in Ruby

DevFeed: [Debugging hidden memory leaks in Ruby](<https://devfeed.tech/articles/debugging-hidden-memory-leaks-in-ruby-22435.md>)

Original publisher: [Read original article](<https://samsaffron.com/archive/2019/10/08/debugging-unmanaged-and-hidden-memory-leaks-in-ruby>)

Author: Sam Saffron

Published: 2019-10-15T05:18:18Z

Content type: tutorial

Language: en

Sources: [Sam Saffron](<https://devfeed.tech/sources/sam-saffron.md>)

Topics: [Memory Leaks](<https://devfeed.tech/topics/memory-leaks.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [Tooling](<https://devfeed.tech/topics/tooling.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [memory-leaks](<https://devfeed.tech/tags/memory-leaks.md>), [net](<https://devfeed.tech/tags/net.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [saffron](<https://devfeed.tech/tags/saffron.md>), [sam](<https://devfeed.tech/tags/sam.md>), [sql](<https://devfeed.tech/tags/sql.md>), [tooling](<https://devfeed.tech/tags/tooling.md>), [weblog](<https://devfeed.tech/tags/weblog.md>)

### AI overview

A tutorial on diagnosing unmanaged and hidden memory leaks in Ruby. It explains how a program can consume substantially more RSS than Ruby's ObjectSpace reports, then presents mwrap and related tools for tracing allocations and identifying leak sources.

### Source excerpt

In 2015 I wrote about some of the tooling Ruby provides for diagnosing managed memory leaks. The article mostly focused on the easy managed leaks. This article covers tools and tricks you can use to attack leaks that you can not easily introspect in Ruby. In particular I will discuss mwrap, heaptrack, iseq_collector and chap. image1787x742 230 KB An unmanaged memory leak This little program leaks memory by calling malloc directly. It starts off consuming 16MB and finishes off consuming 118MB of RSS. The code allocates 100k blocks of 1024 bytes and de-allocates 50 thousand of them. require 'fiddle' require 'objspace' def usage rss = `ps -p #{Process.pid} -o rss -h`.strip.to_i * 1024 puts "RSS: #{rss / 1024} ObjectSpace size #{ObjectSpace.memsize_of_all / 1024}" end def leak_memory pointers = [] 100_000.times do i = Fiddle.malloc(1024) pointers << i end 50_000.times do Fiddle.free(pointers.pop) end end usage # RSS: 16044 ObjectSpace size 2817 leak_memory usage # RSS: 118296 ObjectSpace size 3374 Even though our RSS is 118MB, our Ruby object space is only aware of 3MB, introspection wise we have very little visibility of this very large memory leak. A real world example of such a leak is documented by Oleg Dashevskii, it is an excellent article worth reading. Enter Mwrap Mwrap is a memory profiler for Ruby that keeps track of all allocations by intercepting malloc and family calls. It does so by intercepting the real calls that allocate and free memory using LD_PRELOAD. It uses liburcu for bookkeeping and is able to keep track of allocation and de-allocation counts per call-site for both C code and Ruby. It is reasonably lightweight and will approximately double the RSS for the program being profiled and approximately halve the speed. It differs from many other libraries in that it is very lightweight and Ruby aware. It track locations in Ruby files and is not limited to C level backtrackes valgrind+masif and similar profilers show. This makes isolating actual sources

## C Portability Lessons from Old Machines

DevFeed: [C Portability Lessons from Old Machines](<https://devfeed.tech/articles/c-portability-lessons-from-old-machines-21483.md>)

Original publisher: [Read original article](<https://begriffs.com/posts/2018-11-15-c-portability.html>)

Published: 2018-11-15T00:00:00Z

Content type: article

Language: en

Sources: [Joe Nelson](<https://devfeed.tech/sources/joe-nelson.md>)

Topics: [C](<https://devfeed.tech/topics/c.md>), [Hardware](<https://devfeed.tech/topics/hardware.md>), [systems](<https://devfeed.tech/topics/systems.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [architectures](<https://devfeed.tech/tags/architectures.md>), [article](<https://devfeed.tech/tags/article.md>), [book](<https://devfeed.tech/tags/book.md>), [c](<https://devfeed.tech/tags/c.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [hardware](<https://devfeed.tech/tags/hardware.md>), [microcontrollers](<https://devfeed.tech/tags/microcontrollers.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [portable](<https://devfeed.tech/tags/portable.md>), [porting](<https://devfeed.tech/tags/porting.md>), [systems](<https://devfeed.tech/tags/systems.md>), [technical](<https://devfeed.tech/tags/technical.md>)

### AI overview

The article examines C portability by tracing how carefully written ANSI C using standard library functions can compile and work across systems ranging from 4-bit microcontrollers to room-sized mainframes. It uses unusual architectures, word sizes, integer representations, and pointer models to show how portable code separates the language from the environment and remains applicable to modern CPUs.

### Source excerpt

2018-11-15 In this article we'll go on a journey from 4-bit microcontrollers to room-sized mainframes and learn how porting C to each of them helped people separate the essence of the language from the environment of its birth. I've found technical manuals and videos for this article to help bring each computer to life.

## Escape-Analysis Flaws

DevFeed: [Escape-Analysis Flaws](<https://devfeed.tech/articles/escape-analysis-flaws-22131.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2018/01/escape-analysis-flaws.html>)

Published: 2018-01-22T00:00:00Z

Content type: article

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Static code analysis](<https://devfeed.tech/topics/static-code-analysis.md>), [toolchain](<https://devfeed.tech/topics/toolchain.md>)

Tags: [analysis](<https://devfeed.tech/tags/analysis.md>), [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code-analysis](<https://devfeed.tech/tags/code-analysis.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [escape-analysis](<https://devfeed.tech/tags/escape-analysis.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>), [series](<https://devfeed.tech/tags/series.md>)

### AI overview

This article examines unresolved flaws in Go's escape analysis, a compiler analysis that enables memory-management optimizations. It identifies five flaws that had not been fixed at the time of writing and explores their potential impact on existing Go programs, based on the Go 1.9 compiler.

### Source excerpt

Prelude It will be helpful to read this four-part series first on escape analysis and data semantics. Details on how to read an escape analysis report and pprof output have been outlined here. https://www.ardanlabs.com/blog/2017/05/language-mechanics-on-stacks-and-pointers.html Introduction Even after working with Go for 4 years, I am continually amazed by the language. Thanks to the static code analysis the compiler performs, the compiler can apply interesting optimizations to the code it produces. One type of analysis the compiler performs is called escape analysis. This produces optimizations and simplifications around memory management.

## Tutorial: Pagination

DevFeed: [Tutorial: Pagination](<https://devfeed.tech/articles/tutorial-pagination-23549.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/tutorial>)

Author: Ramya Nagarajan

Published: 2017-09-19T00:10:00Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>), [React](<https://devfeed.tech/topics/react.md>), [apollo-client](<https://devfeed.tech/topics/apollo-client.md>), [client](<https://devfeed.tech/topics/client.md>), [Server](<https://devfeed.tech/topics/server.md>)

Tags: [apollo-client](<https://devfeed.tech/tags/apollo-client.md>), [git](<https://devfeed.tech/tags/git.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [load](<https://devfeed.tech/tags/load.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [react](<https://devfeed.tech/tags/react.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

### AI overview

Part 8 of a full-stack React and GraphQL tutorial series explains how to implement cursor-based pagination. It covers using cursors and limits, Apollo Client, and loading messages in smaller chunks in response to a button click.

### Source excerpt

This is part 8 of our full-stack React + GraphQL tutorial series. Each part is self-contained and introduces one new key concept, so you can either do each part separately or follow the entire series -- it's up to you! Here are the sections we've covered so far: In Parts 6 and 7 we went over how to add subscriptions to the server and hot-load changes to the server in your client. In this part, we'll add pagination so your server can send data in smaller chunks, rather than everything at once.

## XHCI Ring Data Structures

DevFeed: [XHCI Ring Data Structures](<https://devfeed.tech/articles/xhci-ring-data-structures-33061.md>)

Original publisher: [Read original article](<https://reactos.org/blogs/xhci-ring-data-structures/>)

Published: 2017-07-18T00:00:00Z

Content type: article

Language: en

Sources: [Front Page on ReactOS Website](<https://devfeed.tech/sources/front-page-on-reactos-website.md>)

Topics: [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [block](<https://devfeed.tech/tags/block.md>), [command](<https://devfeed.tech/tags/command.md>), [commands](<https://devfeed.tech/tags/commands.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [free](<https://devfeed.tech/tags/free.md>), [implement](<https://devfeed.tech/tags/implement.md>), [linux](<https://devfeed.tech/tags/linux.md>), [memory](<https://devfeed.tech/tags/memory.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [os](<https://devfeed.tech/tags/os.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [queue](<https://devfeed.tech/tags/queue.md>), [react](<https://devfeed.tech/tags/react.md>), [reactos](<https://devfeed.tech/tags/reactos.md>), [win32](<https://devfeed.tech/tags/win32.md>), [winapi](<https://devfeed.tech/tags/winapi.md>)

### AI overview

This article explains XHCI ring data structures, including command, event, and transfer rings, and describes how rings use Transfer Request Blocks and linked segments. It compares implementations in Linux and Haiku and notes that the author's implementation initially follows Haiku's approach, with a goal of eventually matching Linux's design.

### Source excerpt

xHC functioning mostly depends on different ring data structures. In this blog post I'm going to detail what a ring is in XHCI and various implementations by Linux and Haiku. A ring is a circular queue of data structures. There are three kinds of rings in xHC. 1. Command ring 2. Event Ring 3. Transfer Ring These rings are the basis of communication with the Controller. Command Ring is used to send commands to the controller.

## Interface Semantics

DevFeed: [Interface Semantics](<https://devfeed.tech/articles/interface-semantics-22129.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2017/07/interface-semantics.html>)

Published: 2017-07-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [developers](<https://devfeed.tech/tags/developers.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>), [programming-language](<https://devfeed.tech/tags/programming-language.md>)

### AI overview

This tutorial explains value and pointer semantics for interfaces in the Go programming language. It shows how interfaces can store either a copy of a value or a copy of its address, and why only the pointer-semantic interface observes later changes to the original value.

### Source excerpt

Prelude If you want to put this post in some better context, I suggest reading the following series of posts, which lay out some other fundamental and relevant design principles: Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics In particular, the idea of value and pointer semantics is everywhere in the Go programming language. As stated in those earlier posts, semantic consistency is critical for integrity and readability. It allows developers to maintain a strong mental model of a code base as it continues to grow. It also helps to minimize mistakes, side effects, and unexpected behavior.

## For Range Semantics

DevFeed: [For Range Semantics](<https://devfeed.tech/articles/for-range-semantics-22127.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2017/06/for-range-semantics.html>)

Published: 2017-06-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Programming language](<https://devfeed.tech/topics/programming-language.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [loops](<https://devfeed.tech/tags/loops.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>), [programming-language](<https://devfeed.tech/tags/programming-language.md>), [readability](<https://devfeed.tech/tags/readability.md>)

### AI overview

This tutorial explains value and pointer semantics in Go range loops. It compares how loops operate on copies versus original values, shows how mixing the two forms can cause problems, and examines the mechanics through code examples.

### Source excerpt

Prelude These are good posts to read first to better understand the material presented in this post: Index of the four part series: Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics The idea of value and pointer semantics are everywhere in the Go programming language. As stated before in those earlier posts, semantic consistency is critical for integrity and readability. It allows developers to maintain a strong mental model of a code base as it continues to grow. It also helps to minimize mistakes, side effects, and unknown behavior.

## Maintaining a Swift and Objective-C Hybrid Codebase

DevFeed: [Maintaining a Swift and Objective-C Hybrid Codebase](<https://devfeed.tech/articles/maintaining-a-swift-and-objective-c-hybrid-codebase-1476.md>)

Original publisher: [Read original article](<https://shopify.engineering/maintaining-a-swift-and-objective-c-hybrid-codebase>)

Author: Adrianna Chang

Published: 2017-06-15T18:13:00Z

Content type: article

Language: en

Sources: [Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering.md>), [Shopify Engineering - Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering-shopify-engineering.md>)

Topics: [Swift](<https://devfeed.tech/topics/swift.md>), [Objective-C](<https://devfeed.tech/topics/objective-c.md>), [interoperability](<https://devfeed.tech/topics/interoperability.md>), [iOS](<https://devfeed.tech/topics/ios.md>), [Code](<https://devfeed.tech/topics/code.md>), [WebKit](<https://devfeed.tech/topics/webkit.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [bridging](<https://devfeed.tech/tags/bridging.md>), [c](<https://devfeed.tech/tags/c.md>), [crash](<https://devfeed.tech/tags/crash.md>), [ios](<https://devfeed.tech/tags/ios.md>), [null](<https://devfeed.tech/tags/null.md>), [optional](<https://devfeed.tech/tags/optional.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [swift](<https://devfeed.tech/tags/swift.md>)

### AI overview

This article explains how to maintain a hybrid Swift and Objective-C codebase when adding new Swift code to an existing actively supported Objective-C project. It discusses interoperability between the two languages and the importance of correct nullability annotations for preserving Swift's compile-time optionality guarantees and avoiding runtime crashes.

### Source excerpt

6 minute read Swift is gaining popularity among iOS developers, which is of no surprise. It's strictly typed, which means you can prove the correctness of your program at compile time, given that your typesystem describes the domain well. It's a modern language offering syntax constructs encouraging developers to write better architecture using fewer lines of code, making it expressive. It's more fun to work with, and all the new Cocoa projects are being written in Swift. At Shopify, we want to adopt Swift where it makes sense, while understanding that many existing projects have an extensive codebase (some of them written years ago) in Objective-C (OBJC) that are still actively supported. It's tempting to write new code in Swift, but we can't migrate all the existing OBJC codebase quickly. And sometimes it just isn't worth the effort.

## Design Philosophy On Data And Semantics

DevFeed: [Design Philosophy On Data And Semantics](<https://devfeed.tech/articles/design-philosophy-on-data-and-semantics-22126.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2017/06/design-philosophy-on-data-and-semantics.html>)

Published: 2017-06-08T00:00:00Z

Content type: opinion

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Code](<https://devfeed.tech/topics/code.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [escape-analysis](<https://devfeed.tech/tags/escape-analysis.md>), [gc](<https://devfeed.tech/tags/gc.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [integrity](<https://devfeed.tech/tags/integrity.md>), [memory](<https://devfeed.tech/tags/memory.md>), [mental-models](<https://devfeed.tech/tags/mental-models.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>), [readability](<https://devfeed.tech/tags/readability.md>)

### AI overview

The final post in a four-part series on Go language mechanics discusses how value and pointer semantics affect stack and heap allocation, garbage-collector pressure, copying, and efficiency. It argues that using consistent semantics for a given data type improves code integrity, readability, and maintainable mental models.

### Source excerpt

Prelude This is the final post in a four part series discussing the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on data and the design philosophies of applying value/pointer semantics in your code. Index of the four part series: Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics Design Philosophies "Value semantics keep values on the stack, which reduces pressure on the Garbage Collector (GC). However, value semantics require various copies of any given value to be stored, tracked and maintained. Pointer semantics place values on the heap, which can put pressure on the GC. However, pointer semantics are efficient because only one value needs to be stored, tracked and maintained." - Bill Kennedy

## Language Mechanics On Escape Analysis

DevFeed: [Language Mechanics On Escape Analysis](<https://devfeed.tech/articles/language-mechanics-on-escape-analysis-22124.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2017/05/language-mechanics-on-escape-analysis.html>)

Published: 2017-05-26T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Static code analysis](<https://devfeed.tech/topics/static-code-analysis.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Code](<https://devfeed.tech/topics/code.md>), [cpu](<https://devfeed.tech/topics/cpu.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [escape-analysis](<https://devfeed.tech/tags/escape-analysis.md>), [gc](<https://devfeed.tech/tags/gc.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [memory](<https://devfeed.tech/tags/memory.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

This tutorial explains heaps and escape analysis in Go. It describes how the compiler uses static code analysis to decide whether values remain on a function's stack or move to the heap, and discusses the resulting garbage-collection costs and possible latency.

### Source excerpt

Prelude This is the second post in a four part series that will provide an understanding of the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on heaps and escape analysis. Index of the four part series: Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics Introduction In the first post in this four part series, I taught the basics of pointer mechanics by using an example in which a value was shared down a goroutine's stack. What I did not show you is what happens when you share a value up the stack. To understand this, you need to learn about another area of memory where values can live: the "heap". With that knowledge, you can then begin to learn about "escape analysis".

## Language Mechanics On Stacks And Pointers

DevFeed: [Language Mechanics On Stacks And Pointers](<https://devfeed.tech/articles/language-mechanics-on-stacks-and-pointers-22125.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2017/05/language-mechanics-on-stacks-and-pointers.html>)

Published: 2017-05-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Code](<https://devfeed.tech/topics/code.md>), [Software](<https://devfeed.tech/topics/software.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [code](<https://devfeed.tech/tags/code.md>), [concurrent](<https://devfeed.tech/tags/concurrent.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [language](<https://devfeed.tech/tags/language.md>), [memory](<https://devfeed.tech/tags/memory.md>), [performance](<https://devfeed.tech/tags/performance.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

This first post in a four-part series explains how stacks, frame boundaries, pointers, and pass-by-value semantics work in Go. It describes how function calls transition between memory frames and how data is transferred between them, with attention to readability, bugs, and performance.

### Source excerpt

Prelude This is the first post in a four part series that will provide an understanding of the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on stacks and pointers. Index of the four part series: Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics Introduction I'm not going to sugar coat it, pointers are difficult to comprehend. When used incorrectly, pointers can produce nasty bugs and even performance issues. This is especially true when writing concurrent or multi-threaded software. It's no wonder so many languages attempt to hide pointers away from programmers. However, if you are writing software in Go, there is no way for you to avoid them. Without a strong understanding of pointers, you will struggle to write clean, simple and efficient code.

## Using Pointers In Go

DevFeed: [Using Pointers In Go](<https://devfeed.tech/articles/using-pointers-in-go-22108.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2014/12/using-pointers-in-go.html>)

Published: 2014-12-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Code](<https://devfeed.tech/topics/code.md>), [coding](<https://devfeed.tech/topics/coding.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [coding](<https://devfeed.tech/tags/coding.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [performance](<https://devfeed.tech/tags/performance.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

This tutorial explains when to use pointers in Go. It argues that pointer decisions should be based on idiomatic, simple, readable, and reasonable code rather than assumed performance tradeoffs, then examines common practices for built-in, struct, and reference types.

### Source excerpt

Introduction I am asked quite a bit about when and when not to use pointers in Go. The problem most people have, is that they try to make this decision based on what they think the performance tradeoff will be. Hence the problem, don't make coding decisions based on unfounded thoughts you may have about performance. Make coding decisions based on the code being idiomatic, simple, readable and reasonable.

[Next page](<https://devfeed.tech/tags/pointers.md?cursor=WyIyMDE0LTEyLTE2VDAwOjAwOjAwKzAwOjAwIiwgImVhMmY2NGY2LWRiODItNDI4Yy05YjA5LTYxZGRiNjU5ODg0YSJd>)