Skip to content

Instantly share code, notes, and snippets.

View alk's full-sized avatar

Aliaksiej Kandracienka (aka Aliaksei Kandratsenka) alk

View GitHub Profile
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*-
// #include "config_for_unittests.h"
#include "gtest/gtest.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <unordered_map>
#include <errno.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define NUM_THREADS 8
diff --git a/src/common.h b/src/common.h
index cb45315..e9976c1 100644
--- a/src/common.h
+++ b/src/common.h
@@ -27,60 +27,65 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ---
From 4cd069d0ef876dc1053d09c9785a6cd451061f19 Mon Sep 17 00:00:00 2001
From: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Date: Mon, 22 May 2017 03:18:11 -0700
Subject: [PATCH] Use hidden visibility for TCMallocGetenvSafe
Because otherwise it might be unsafe to call it from ifunc
handler (when non-lazy symbol binding is in effect).
---
src/base/sysinfo.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
#include <sys/mman.h>
#include <sys/types.h>
#include <time.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
int main(void)
{
void *addr = mmap(0, (4 << 20) - 4096, PROT_NONE,
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <string.h>
#include <stdint.h>
#include <emmintrin.h>
static void setbytes(char *p, int c)
{
@alk
alk / goprof-test.go
Created February 20, 2016 22:12
Test program demonstrating skewed profile
package main
import (
"log"
"os"
"runtime/pprof"
"time"
)
func maybeStartProfile() func() {
@alk
alk / freelist2.cc
Created January 26, 2016 18:52
some freelist representation ideas
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
#include <memory.h>
struct FreeListEntry {
FreeListEntry *l, *r;
};
@alk
alk / maps-balancedness.rb
Last active February 22, 2016 11:40
maps-balancedness.rb
#!/usr/bin/ruby
# coding: utf-8
require 'json'
require 'pp'
require 'optparse'
require 'rubygems'
require 'restclient'
@alk
alk / alk-malloc-test.c
Created June 21, 2014 21:43
alk-malloc-test
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <assert.h>
#define HISTORY_SIZE (1024*1024)
#define CHUNK_MIN (2*1024*1024)
#define CHUNK_MAX (32*1024*1024)