我即将为科学项目编写一个(非常)大的代码,其中将使用大量可分配的数组。是否有一个固有的fortran函数或者我可以使用的编译器标志,它检查所有可分配的变量是否已被正确释放?我正在使用gfortran
。
答案 0 :(得分:0)
gcc以及gfortran可以使用AddressSanitizer库来检测内存泄漏。可以使用version: '3'
services:
consul-leader:
container_name: consul-leader
image: consul
command: agent -server -client=0.0.0.0 -bootstrap -ui
volumes:
- consul-data-leader:/consul/data
environment:
- CONSUL_BIND_INTERFACE=eth0
- 'CONSUL_LOCAL_CONFIG={"leave_on_terminate": true}'
networks:
- default
- front-end
deploy:
labels:
- traefik.frontend.rule=Host:consul.domain.com
- traefik.port=8500
- traefik.docker.network=front-end
# Traefik service that listens to HTTP
- traefik.redirectorservice.frontend.entryPoints=http
- traefik.redirectorservice.frontend.redirect.entryPoint=https
# Traefik service that listens to HTTPS
- traefik.webservice.frontend.entryPoints=https
consul-replica:
container_name: consul-replica
image: consul
command: agent -server -client=0.0.0.0 -retry-join="consul-leader"
volumes:
- consul-data-replica:/consul/data
environment:
- CONSUL_BIND_INTERFACE=eth0
- 'CONSUL_LOCAL_CONFIG={"leave_on_terminate": true}'
networks:
- default
- front-end
deploy:
replicas: 0
placement:
preferences:
- spread: node.id
traefik:
container_name: traefik
image: traefik:v1.7
ports:
- target: 80
published: 80
mode: host
- target: 443
published: 443
mode: host
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
preferences:
- spread: node.id
labels:
- traefik.frontend.rule=Host:traefik.domain.com
- traefik.port=8080
- traefik.docker.network=front-end
# Traefik service that listens to HTTP
- traefik.redirectorservice.frontend.entryPoints=http
- traefik.redirectorservice.frontend.redirect.entryPoint=https
# Traefik service that listens to HTTPS
- traefik.webservice.frontend.entryPoints=https
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /docker/ssl:/docker/ssl
command: >
--docker
--docker.swarmmode
--docker.watch
--docker.exposedbydefault=true
--entrypoints='Name:http Address::80'
--entrypoints='Name:https Address::443 TLS'
--consul
--consul.watch
--consul.endpoint="consul-leader:8500"
--acme
--acme.email=example@email.com
--acme.storage="traefik/acme/account"
--acme.entryPoint=https
--acme.httpChallenge.entryPoint=http
--acme.onhostrule=true
--acme.acmelogging=true
--logLevel=INFO
--accessLog
--api
networks:
- default
- front-end
depends_on:
- consul-leader
volumes:
consul-data-leader:
consul-data-replica:
networks:
front-end:
name: front-end
driver: overlay
选项启用此功能。
输出将类似于-fsanitize=address
的输出:
valgrind
如注释中之前所述,可分配内存不应该发生内存泄漏。另一方面,经验表明,仍然可能存在编译器错误,这些错误仍可能导致内存泄漏。