File: qa-blockmemory

package info (click to toggle)
newlisp 10.7.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,292 kB
  • sloc: ansic: 33,280; lisp: 4,181; sh: 609; makefile: 215
file content (41 lines) | stat: -rwxr-xr-x 1,148 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env newlisp


(println)
(println "Testing cell block allocation and deallocation:")

b1 b2 b3 b4 initial

(seed (time-of-day))
(define (run)
	(set 'initial (sys-info 0))
	(println "initial cell count:" initial)
	(set 'b1 (sequence 1 (+ 10000 (rand 10000))))
	(println "cell count after b1:" (sys-info 0))
	(set 'b2 (sequence 1 (+ 10000 (rand 10000))))
	(println "cell count after b2:" (sys-info 0))
	(set 'b3 (sequence 1 (+ 10000 (rand 10000))))
	(println "cell count after b3:" (sys-info 0))
	(set 'b4 (sequence 1 (+ 10000 (rand 10000))))
	(println "cell count after b4:" (sys-info 0))

	(set 'b2 nil)
	(println "return b2, cell count:" (sys-info 0) ", block count:" (reset nil))
	(set 'b4 nil)
	(println "return b4, cell count:" (sys-info 0) ", block count:" (reset nil))
	(set 'b1 nil)
	(println "return b1, cell count:" (sys-info 0) ", block count:" (reset nil))
	(set 'b3 nil)
	(println "return b3, cell count:" (sys-info 0) ", block count:" (reset nil))

    (= initial (sys-info 0))
)

(if (run)
	(println ">>>>> Memory allocation/deallocation SUCCESSFUL")
	(println ">>>>> PROBLEM in memory allocation/deallocaton"))
	
(exit)