summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-01-30 21:11:37 +0100
committerAraq <rumpf_a@web.de>2017-01-30 21:11:37 +0100
commit79f4b37d3b251ede2704d278a0914daa42d361c9 (patch)
tree90c0c73dece25a28236f12975fdefaa3cbc13428 /lib
parentb26e6e3589f0564c6c3838cdd09d810dea6b1080 (diff)
downloadNim-79f4b37d3b251ede2704d278a0914daa42d361c9.tar.gz
added test case; threadex example crashes now
Diffstat (limited to 'lib')
-rw-r--r--lib/system/alloc.nim6
-rw-r--r--lib/system/gc.nim2
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim
index e630aa3c1..37fd07719 100644
--- a/lib/system/alloc.nim
+++ b/lib/system/alloc.nim
@@ -103,7 +103,7 @@ type
     root, deleted, last, freeAvlNodes: PAvlNode
     locked, blockChunkSizeIncrease: bool # if locked, we cannot free pages.
     nextChunkSize: int
-{.deprecated: [TLLChunk: LLChunk, TAvlNode: AvlNode, TMemRegion: MemRegion].}
+{.deprecated: [TMemRegion: MemRegion].}
 
 # shared:
 var
@@ -312,6 +312,8 @@ proc requestOsChunks(a: var MemRegion, size: int): PBigChunk =
   incCurrMem(a, size)
   inc(a.freeMem, size)
   result.heapLink = a.heapLink
+  when defined(debugHeapLinks):
+    cprintf("owner: %p; result: %p; next pointer %p\n", addr(a), result, result.heapLink)
   result.origSize = size
   a.heapLink = result
 
@@ -713,6 +715,8 @@ proc deallocOsPages(a: var MemRegion) =
   # we free every 'ordinarily' allocated page by iterating over the page bits:
   var it = a.heapLink
   while it != nil:
+    when defined(debugHeapLinks):
+      cprintf("owner %p; dealloc A: %p\n", addr(a), it)
     let next = it.heapLink
     sysAssert it.origSize >= PageSize, "origSize too small"
     # note:
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index 18d41219d..686729a68 100644
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -472,7 +472,7 @@ proc rawNewObj(typ: PNimType, size: int, gch: var GcHeap): pointer =
   gcAssert(typ.kind in {tyRef, tyString, tySequence}, "newObj: 1")
   collectCT(gch)
   var res = cast[PCell](rawAlloc(gch.region, size + sizeof(Cell)))
-  gcAssert typ.kind in {tyString, tySequence} or size >= typ.base.size, "size too small"
+  #gcAssert typ.kind in {tyString, tySequence} or size >= typ.base.size, "size too small"
   gcAssert((cast[ByteAddress](res) and (MemAlign-1)) == 0, "newObj: 2")
   # now it is buffered in the ZCT
   res.typ = typ