@@ -255,184 +255,4 @@ let ``[Caches] ConditionalWeakTable: input holding output``() =
255
255
Log.line " RuntimeObject Count=%d " RuntimeObject.ObjCount
256
256
257
257
if RuntimeObject.ObjCount > 100 then
258
- failwith " leak"
259
-
260
- [<Test>]
261
- let ``[ Caches ] BinaryCache2 forward`` () =
262
-
263
- let a = " hugo"
264
-
265
- let mutable compCount = 0
266
- let cache = BinaryCache2<_, _, _>(( fun a b ->
267
- let res = a.ToString() + b.ToString()
268
- compCount <- compCount + 1
269
- Log.line " result created"
270
- res))
271
-
272
- let sw = Stopwatch.StartNew()
273
- let mutable i = 0
274
- let random = Random( 123 )
275
- let mutable temp = RuntimeObject( sprintf " run-%i " i)
276
-
277
- while sw.Elapsed.TotalSeconds < 10.0 do
278
-
279
- let resCount =
280
- if random.NextDouble() < 0.1 || i = 0 then
281
- temp <- RuntimeObject( sprintf " run-%i " i)
282
- compCount + 1
283
- else
284
- compCount
285
-
286
- let result = cache.Invoke( a, temp)
287
-
288
- if resCount <> compCount then
289
- failwith " caching failed"
290
-
291
- Log.line " created: %A " result
292
-
293
- i <- i + 1
294
-
295
- System.GC.Collect( 3 )
296
- System.GC.WaitForFullGCComplete() |> ignore
297
-
298
- System.GC.Collect( 3 )
299
- System.GC.WaitForFullGCComplete() |> ignore
300
-
301
- Log.line " RuntimeObject Count=%d " RuntimeObject.ObjCount
302
-
303
- if RuntimeObject.ObjCount > 100 then
304
- failwith " leak"
305
-
306
- [<Test>]
307
- let ``[ Caches ] BinaryCache2 backward`` () =
308
-
309
- let a = " hugo"
310
-
311
- let mutable compCount = 0
312
- let cache = BinaryCache2<_, _, _>(( fun a b ->
313
- let res = a.ToString() + b.ToString()
314
- compCount <- compCount + 1
315
- Log.line " result created: %s " res
316
- res))
317
-
318
- let sw = Stopwatch.StartNew()
319
- let mutable i = 0
320
- let random = Random( 123 )
321
- let mutable temp = RuntimeObject( sprintf " run-%i " i)
322
-
323
- while sw.Elapsed.TotalSeconds < 10.0 do
324
-
325
- let resCount =
326
- if random.NextDouble() < 0.1 || i = 0 then
327
- temp <- RuntimeObject( sprintf " run-%i " i)
328
- compCount + 1
329
- else
330
- compCount
331
-
332
- let result = cache.Invoke( temp, a)
333
-
334
- if resCount <> compCount then
335
- failwith " caching failed"
336
-
337
- Log.line " created: %A " result
338
-
339
- i <- i + 1
340
-
341
- System.GC.Collect( 3 )
342
- System.GC.WaitForFullGCComplete() |> ignore
343
-
344
- System.GC.Collect( 3 )
345
- System.GC.WaitForFullGCComplete() |> ignore
346
-
347
- Log.line " RuntimeObject Count=%d " RuntimeObject.ObjCount
348
-
349
- if RuntimeObject.ObjCount > 100 then
350
- failwith " leak"
351
-
352
- [<Test>]
353
- [<Ignore( " issue by design -> see comment in BinaryChache2" ) >]
354
- let ``[ Caches ] BinaryCache2 forward with ResultObject`` () =
355
-
356
- let a = " hugo"
357
-
358
- let cache = BinaryCache2<_, _, _>(( fun a b -> ResultObject( a, b)))
359
-
360
- let sw = Stopwatch.StartNew()
361
- let mutable i = 0
362
-
363
- let rnd = Random( 123 )
364
- let mutable temp = Unchecked.defaultof<_>
365
-
366
- while sw.Elapsed.TotalSeconds < 10.0 do
367
-
368
- let resCount =
369
- if rnd.NextDouble() < 0.1 || i = 0 then
370
- temp <- RuntimeObject( sprintf " run-%i " i)
371
- ResultObject< string, RuntimeObject>. ResCount + 1
372
- else
373
- ResultObject< string, RuntimeObject>. ResCount
374
-
375
- let result = cache.Invoke( a, temp)
376
-
377
- if resCount <> ResultObject< string, RuntimeObject>. ResCount then
378
- failwith " cache not working"
379
-
380
- Log.line " created: %A " result
381
-
382
- i <- i + 1
383
-
384
- System.GC.Collect( 3 )
385
- System.GC.WaitForFullGCComplete() |> ignore
386
-
387
- System.GC.Collect( 3 )
388
- System.GC.WaitForFullGCComplete() |> ignore
389
-
390
- Log.line " RuntimeObject Count=%d " RuntimeObject.ObjCount
391
-
392
- if RuntimeObject.ObjCount > 100 then
393
- failwith " leak"
394
-
395
- [<Test>]
396
- [<Ignore( " issue by design -> see comment in BinaryChache2" ) >]
397
- let ``[ Caches ] BinaryCache2 backward with ResultObject`` () =
398
-
399
- let a = " hugo"
400
-
401
- let cache = BinaryCache2<_, _, _>(( fun a b -> ResultObject( a, b)))
402
-
403
- let sw = Stopwatch.StartNew()
404
- let mutable i = 0
405
-
406
- let rnd = Random( 123 )
407
- let mutable temp = Unchecked.defaultof<_>
408
-
409
- while sw.Elapsed.TotalSeconds < 10.0 do
410
-
411
- let resCount =
412
- if rnd.NextDouble() < 0.1 || i = 0 then
413
- temp <- RuntimeObject( sprintf " run-%i " i)
414
- ResultObject< RuntimeObject, string>. ResCount + 1
415
- else
416
- ResultObject< RuntimeObject, string>. ResCount
417
-
418
- let result = cache.Invoke( temp, a)
419
-
420
- if resCount <> ResultObject< RuntimeObject, string>. ResCount then
421
- failwith " cache not working"
422
-
423
- Log.line " created: %A " result
424
-
425
- i <- i + 1
426
-
427
- System.GC.Collect( 3 )
428
- System.GC.WaitForFullGCComplete() |> ignore
429
-
430
- System.GC.Collect( 3 )
431
- System.GC.WaitForFullGCComplete() |> ignore
432
-
433
- Log.line " RuntimeObject Count=%d " RuntimeObject.ObjCount
434
-
435
- if RuntimeObject.ObjCount > 100 then
436
- failwith " leak"
437
-
438
-
258
+ failwith " leak"
0 commit comments