FrankRay78/PatienceOS

Allocate new objects on the heap, not stack

Opened this issue · 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 👍 this issue if you are interested in it.

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.

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 I believe the map shows the free physical memory the kernel can use, eg. new heap allocations, loading executables etc.

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