PatienceOS icon indicating copy to clipboard operation
PatienceOS copied to clipboard

Allocate new objects on the heap, not stack

Open FrankRay78 opened this issue 1 year ago • 4 comments

A custom allocator for managed .Net is ideally what's needed, failing that, just plain old malloc/free calls would be a sufficient starting place.

Reference implementations

From MOOS, this looks very interesting: private static unsafe object RhpNewFast(EEType* pEEType)

bflat PR 79: Allow manual heap deallocation with zerolib

Background reading

Visual overview of a custom malloc() implementation Anatomy of a Program in Memory Hijacking the .Net new() operator

Advanced reading

Memory Management - D Lang


Please upvote :+1: this issue if you are interested in it.

FrankRay78 avatar Mar 02 '24 17:03 FrankRay78

OS Dev, see: Memory Map, Detecting Memory and Writing a memory manager

A Multiboot2-compliant bootloader provides an information structure when the kernel boots, for example: the memory map.

This would be an excellent way to inform the memory allocator what memory could be used for heap allocation.

FrankRay78 avatar Apr 14 '24 19:04 FrankRay78

I am not well versed in low level kernel memory mapping, but is this map for lower level datatype eg: c/c++ to higher level data type in C#?

Tajbiul-Rawol avatar May 15 '24 07:05 Tajbiul-Rawol

@Tajbiul-Rawol I believe the map shows the free physical memory the kernel can use, eg. new heap allocations, loading executables etc.

FrankRay78 avatar May 15 '24 08:05 FrankRay78

@Tajbiul-Rawol FYI. I'm continuing my OS development here for the time being: https://github.com/FrankRay78/InstructionOS

FrankRay78 avatar Jun 11 '24 11:06 FrankRay78