minimize use of new and delete in engine
@mikestillman is already working on this.
Since Aug 9, 2019.
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
In the file e/newdelete.cpp, we redefine global new, delete, to call GC_MALLOC_UNCOLLECTABLE. Removing these definitions causes M2 to crash during startup (reading the m2 files). Changing these calls to GC_MALLOC_ATOMIC also causes M2 to crash.
The main problem is that one cannot have containers containing pointers to GC allocated memory, in a memory block not allocated by GC. (GC == libgc, the Boehm-Demers garbage collector that we use).
But allocating with either the built in new or GC_MALLOC_ATOMIC is faster that GC_MALLOC_UNCOLLECTABLE in inner loop code.
So: change all uses of new in engine code to something like new_atomic, new_container_containing_gc_allocated_memory.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.