只显示主题贴

我们在编写lua模块的时候经常会遇到申请内存的情况,有2中用途 1。 临时的 2. 长期的。 通常我们是用malloc来分配内存 free来释放。但是这样做的话 lua runtime就没有办法跟踪内存的使用。但是我们有解决方法: 1. 临时的 通过LuaL_Buffer来, 因为LuaL_buffer有自主扩展能力,所以我们可以存入很多数据 只是每次可以直接使用buffer的大小有限制。 2. 长期的, 通过lua_newuserdata 放在fenv里面. fenv 是个table,而且可以gc. 当分配的内存不够用的时候 可以重新分配一个 然后lua_replace一下 这样旧的内存就会 ...
Ascii85 (also called "Base85") is a form of binary-to-text encoding developed by Paul E. Rutter for the btoa utility. By using five ASCII characters to represent four bytes of binary data (encoded size 25% larger), it is more efficient than uuencode or Base64, which use four characters to represent ...
What is Alien Alien is a Foreign Function Interface (FFI) for Lua. An FFI lets you call functions in dynamic libraries (.so, .dylib, .dll, etc.) from Lua code without having to write, compile and link a C binding from the library to Lua. In other words, it lets you write extensions that call out to ...
Announcing LuaEdit 2008 and new website Jean-François Goulet - 2008-06-24 21:14 - LuaEdit LuaEdit is getting a whole new look with the upcoming version of LuaEdit 2008 which will support the latest version of Lua 5.1, remote debugging, easy software integration and solution oriented manageme ...
原来这个还是有故事的,请看:[程序]朱照远(Joshua Zhu) - 拜Igor神,拜Roberto神 说: (2008-06-26 15:23:38)http://en.wikipedia.org/wiki/Strlcpy[程序]朱照远(Joshua Zhu) - 拜Igor神,拜Roberto神 说: (2008-06-26 15:23:56)原来是来自与OpenBSD[程序]朱照远(Joshua Zhu) - 拜Igor神,拜Roberto神 说: (2008-06-26 15:27:01)每个serious的网络程序都自己写一个或者copy一份
to messup: 估计你这么理解 一用就错了
问题是n家族的字符串函数是不是大家都了解语义 都不会用错?
R12B发布以后 号称ASN.1解码速度快了好多。前天仔细看了文档,感觉用在自有的系统去不错。ASN.1的结构还是很紧凑的,BER,PER,BER_BIN,PER_BIN都支持。特别是支持选择性decode,这个feature非常赶兴趣。用在自己的项目里面就省去了很多协议编解码的繁琐和易错,毕竟asn compiler也做了几万行 我相信他的性能。
当tcp对端调用shutdown(RD/WR) 时候, 宿主进程默认将收到{tcp_closed, Socket}消息, 如果这个行为不是你想要的,那么请看: shutdown(Socket, How) -> ok | {error, Reason} Types: Socket = socket() How = read | write | read_write Reason = posix() Immediately close a socket in one or two directions. How == write means closing the socket for ...
这个不是指库的bug 库实现的很好 只是感觉程序员容易把它用错
mryufeng
搜索本博客
最近加入圈子
存档
最新评论