Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Allocate new objects on the heap, not stack #6

Open
FrankRay78 opened this issue Mar 2, 2024 · 4 comments
Open

Allocate new objects on the heap, not stack #6

FrankRay78 opened this issue Mar 2, 2024 · 4 comments
Labels

Comments

@FrankRay78
Copy link
Owner

FrankRay78 commented Mar 2, 2024

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.

@FrankRay78
Copy link
Owner Author

FrankRay78 commented Apr 14, 2024

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.

@Tajbiul-Rawol
Copy link

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#?

@FrankRay78
Copy link
Owner Author

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

@FrankRay78
Copy link
Owner Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants