Skip to main content

Featured

Build docker image from multiple build contexts

Build docker image from multiple build contexts Building a docker image requires specifying a source of truth to include in the image from a local directory or a remote git repository. In the previous version, the docker BuildKit allows users to specify the build context from a single source of truth only. However, the engineers may need to have the context from different locations based on the type of files. For instance, icons, images or other resources that are not included in the same package, including the resource from other docker images. Fortunately, the Docker Buildx toolkit supports multiple build context flag for Docker 1.4. Let's learn how to use this new feature. The following list is a shortcut for jumping into a specific topic handy. What version of Docker is this tutorial targeting? How to specify the version of Dockerfile frontend? Ho

[Linux]malloc_usable_size使用注意事項

在windows下有個可以取得malloc的buffer size的函式-_msize()。

然而在linux底下是沒有相同的函式,所以後來又去網路上找到malloc_usable_size()這個函式。

雖然malloc_usable_size()可以取得到buffer size,不過呢,因為他是dependence on aligment。

所以取得的大小會等於或大於原本buffer size,如果要用來作比對或者是buffer大小計算的話,這邊就很容易出錯了。

至於替代方案目前還沒找到,所以有找到後再補上吧。

以下是參考連結:
http://www.slac.stanford.edu/comp/unix/package/rtems/doc/html/libc/libc.info.malloc.html


以下是部分文字節錄:
   The `malloc_usable_size' function takes a pointer to a block
allocated by `malloc'. It returns the amount of space that is
available in the block. This may or may not be more than the size
requested from `malloc', due to alignment or minimum size constraints.

Comments

Popular Posts