我使用以下伪代码生成PDF文档:
CGContextRef context = CGPDFContextCreateWithURL(url, &rect, NULL);
for (int i = 1; i <= N; i++)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CGContextBeginPage(context, &mediaBox);
// drawing code
CGContextEndPage(context);
[pool release];
}
CGContextRelease(context);
Run Code Online (Sandbox Code Playgroud)
它适用于小文档(N < 100页面),但如果文档超过大约400页(它在崩溃之前收到两个内存警告),它会占用太多内存和崩溃.我确保使用Instruments没有泄漏.您对在iOS上创建大型PDF文档有何建议?非常感谢.
编辑:pdf创建在后台线程中完成.
我正在开发一个需要处理大量REST请求的应用程序.使用基本身份验证将节省大量计算资源,因为我不必计算签名.此外,文档将更加简单.你的想法是什么?
如果我在Erlang中运行多个Web服务器(负载均衡)并且Mnesia用于后端数据库,那么将整个系统升级到更新版本的最佳方法是什么?
我试图在文件夹中使用eunit运行所有单元测试,但似乎超时总是重置为5秒.
例如
模块:
-module(example).
-include_lib("eunit/include/eunit.hrl").
main_test() ->
% sleep for 10 seconds
?assertEqual(true, begin timer:sleep(10000), true end).
Run Code Online (Sandbox Code Playgroud)
命令行:
Eshell V5.7.3 (abort with ^G)
1> c(example).
{ok,example}
2> eunit:test({timeout, 15, example}).
Test passed.
ok
3> eunit:test({timeout, 15, {dir, "."}}).
example: main_test (module 'example')...*timed out*
undefined
=======================================================
Failed: 0. Skipped: 0. Passed: 0.
One or more tests were cancelled.
error
Run Code Online (Sandbox Code Playgroud)
如你所见,运行{timeout, 15, example}但不是{timeout, 15, {dir, "."}}.有人有线索吗?