File: qa-blockmemory.bak

package info (click to toggle)
newlisp 10.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,460 kB
  • ctags: 4,357
  • sloc: ansic: 33,202; lisp: 7,369; java: 7,012; sh: 647; makefile: 273
file content (41 lines) | stat: -rwxr-xr-x 1,144 bytes parent folder | download | duplicates (2)
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/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)