Skip to content

Instantly share code, notes, and snippets.

/*
* A simple on-demand based mmap alloc-only proof-of-concept to just check out the possibilities of having a
* single giant MAP_FIXED allocation for a process that may not need to call free at all and just work with a
* contiguous allocation space
*
* A mmap contiguous hole space is reserved with a PROT_READ and then individual pages overridden with
* PROT_WRITE on page faults in sigsegv handler which mmaps the faulting address space.
*
* As a test, a 1 GIG file is created and then read into the memory allocated from the contiguous vma which is a
* brain-dead linear allocator from the address space as there are no requirements to free memory here.
# Typical way of handling the email in the controller
class UsersController < ApplicationController
def create
@user = User.new params[:user]
UserMailer.deliver_welcome(@user) if @user.save
end
end